@telorun/cli 0.69.0 → 0.71.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/README.md +99 -22
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/cel.d.ts.map +1 -1
- package/dist/commands/cel.js +33 -14
- package/dist/commands/cel.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +43 -8
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +27 -17
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/module.d.ts.map +1 -1
- package/dist/commands/module.js +36 -31
- package/dist/commands/module.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +40 -24
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +15 -4
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +19 -10
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +35 -21
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/controller-progress.d.ts.map +1 -1
- package/dist/controller-progress.js +0 -0
- package/dist/controller-progress.js.map +1 -1
- package/dist/debug-event-subscriber.d.ts.map +1 -1
- package/dist/debug-event-subscriber.js +2 -1
- package/dist/debug-event-subscriber.js.map +1 -1
- package/dist/logger.d.ts +23 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +65 -36
- package/dist/logger.js.map +1 -1
- package/dist/output.d.ts +111 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +143 -0
- package/dist/output.js.map +1 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -283,13 +283,13 @@ Upgrading apps/my-app/telo.yaml
|
|
|
283
283
|
|
|
284
284
|
---
|
|
285
285
|
|
|
286
|
-
### `telo
|
|
286
|
+
### `telo run <path>` (default)
|
|
287
287
|
|
|
288
|
-
Load and run a Telo manifest.
|
|
288
|
+
Load and run a Telo manifest. `run` is the default command, so `telo ./manifest.yaml` and `telo run ./manifest.yaml` are the same thing.
|
|
289
289
|
|
|
290
290
|
**Arguments:**
|
|
291
291
|
|
|
292
|
-
- `
|
|
292
|
+
- `path` - Path to a YAML manifest file, a directory containing `telo.yaml`, or an HTTP(S) URL.
|
|
293
293
|
|
|
294
294
|
**Options:**
|
|
295
295
|
|
|
@@ -301,6 +301,73 @@ Load and run a Telo manifest.
|
|
|
301
301
|
|
|
302
302
|
The cache root defaults to `<manifest-dir>/.telo`; set `TELO_CACHE_DIR` to relocate it (resolved once and used for the manifest cache, compiled validators, analysis stamp, and npm install root alike).
|
|
303
303
|
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### `telo search <query>`
|
|
307
|
+
|
|
308
|
+
Search resource kinds across every module the [hub](https://hub.telo.run) tracks, matched on name and description. This is how you find a kind before you know which module owns it.
|
|
309
|
+
|
|
310
|
+
**Arguments:**
|
|
311
|
+
|
|
312
|
+
- `query` - What the resource should do, in plain words.
|
|
313
|
+
|
|
314
|
+
**Options:**
|
|
315
|
+
|
|
316
|
+
- `--kinds` - Flat kind hits, one line per resource kind, instead of grouping by module
|
|
317
|
+
- `--json` - Emit the hub response as JSON
|
|
318
|
+
- `--hub-url <url>` - Base URL of the hub. Overrides `TELO_HUB_URL`.
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
telo search "key value store"
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
oci://ghcr.io/telorun/kv-store@0.4.0 — Durable key/value storage with atomic conditional writes…
|
|
326
|
+
Store (Provider) A configured durable key/value store: read a value with its version token…
|
|
327
|
+
oci://ghcr.io/telorun/cache@0.11.0 — Caching of computed or fetched values under a key…
|
|
328
|
+
Store (Provider) A configured cache backend that holds values under a key…
|
|
329
|
+
Lookup (Invocable) Reads a cached key and reports the outcome as a miss, a fresh hit or a stale hit…
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Each hit prints the exact ref to paste into your `imports:` map, and the kinds that ref makes available.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### `telo module <subcommand> <ref>`
|
|
337
|
+
|
|
338
|
+
Inspect a module without importing it. `<ref>` is any form the runtime resolves: a local path, an `oci://` ref, a registry ref, or a direct URL.
|
|
339
|
+
|
|
340
|
+
| Subcommand | What it prints |
|
|
341
|
+
| --- | --- |
|
|
342
|
+
| `versions` | The module's published versions, newest first (one entry for a local path or direct URL) |
|
|
343
|
+
| `manifest` | The module's `telo.yaml`, verified against the inline hash when the ref is pinned |
|
|
344
|
+
| `digest` | The version's content-identity digest — a cheap read that downloads no payload |
|
|
345
|
+
| `resources` | The resource instances the module declares |
|
|
346
|
+
| `kinds` | The resource kinds the module defines, with capability and whether each is exported |
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
telo module versions oci://ghcr.io/telorun/console
|
|
350
|
+
telo module kinds oci://ghcr.io/telorun/console@0.16.0
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### `telo cel <subcommand>`
|
|
356
|
+
|
|
357
|
+
Inspect and evaluate Telo's CEL environment — useful for checking an expression's syntax and result without wiring it into a manifest first.
|
|
358
|
+
|
|
359
|
+
| Subcommand | What it does |
|
|
360
|
+
| --- | --- |
|
|
361
|
+
| `functions` | Lists the CEL standard-library functions available in manifests |
|
|
362
|
+
| `eval <expression>` | Evaluates an expression — the body of a `!cel` scalar |
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
telo cel eval "'a-' + string(1+2)"
|
|
366
|
+
# a-3
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
`eval` runs with no manifest loaded, so `variables`, `resources`, `steps` and the rest of the manifest scope are not available; it is for the pure-expression half of CEL.
|
|
370
|
+
|
|
304
371
|
## Examples
|
|
305
372
|
|
|
306
373
|
### Simple HTTP Server
|
|
@@ -311,42 +378,52 @@ Create a file `server.yaml`:
|
|
|
311
378
|
kind: Telo.Application
|
|
312
379
|
metadata:
|
|
313
380
|
name: Example
|
|
381
|
+
version: 1.0.0
|
|
314
382
|
imports:
|
|
315
|
-
|
|
316
|
-
|
|
383
|
+
Http: oci://ghcr.io/telorun/http-server@<version>
|
|
384
|
+
Run: oci://ghcr.io/telorun/run@<version>
|
|
317
385
|
targets:
|
|
318
|
-
- Server
|
|
386
|
+
- !ref Server
|
|
387
|
+
ports:
|
|
388
|
+
http:
|
|
389
|
+
env: PORT
|
|
390
|
+
default: 8080
|
|
391
|
+
variables:
|
|
392
|
+
audience:
|
|
393
|
+
env: AUDIENCE
|
|
394
|
+
type: string
|
|
395
|
+
default: World
|
|
319
396
|
---
|
|
320
397
|
kind: Http.Server
|
|
321
398
|
metadata:
|
|
322
399
|
name: Server
|
|
323
|
-
|
|
324
|
-
baseUrl: http://localhost:8080
|
|
325
|
-
port: 8080
|
|
400
|
+
port: !cel "ports.http"
|
|
326
401
|
mounts:
|
|
327
402
|
- path: /api
|
|
328
|
-
|
|
403
|
+
mount: !ref HelloApi
|
|
329
404
|
---
|
|
330
405
|
kind: Http.Api
|
|
331
406
|
metadata:
|
|
332
407
|
name: HelloApi
|
|
333
|
-
module: Example
|
|
334
408
|
routes:
|
|
335
409
|
- request:
|
|
336
410
|
path: /hello
|
|
337
411
|
method: GET
|
|
338
412
|
handler:
|
|
339
|
-
kind:
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
413
|
+
kind: Run.Value
|
|
414
|
+
# `bindings:` names a temporary value: computed once, read by bare name
|
|
415
|
+
# wherever this resource's expressions need it.
|
|
416
|
+
bindings:
|
|
417
|
+
who: !cel "variables.audience"
|
|
418
|
+
value:
|
|
419
|
+
message: !cel "'Hello, ' + who + '!'"
|
|
420
|
+
greeted: !cel "who"
|
|
421
|
+
returns:
|
|
422
|
+
- status: 200
|
|
423
|
+
content:
|
|
424
|
+
application/json:
|
|
425
|
+
body:
|
|
426
|
+
message: !cel "result.message"
|
|
350
427
|
```
|
|
351
428
|
|
|
352
429
|
Run it:
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import yargs from "yargs";
|
|
3
3
|
import { hideBin } from "yargs/helpers";
|
|
4
|
+
import { OUTPUT_FORMATS, configureOutput, parseOutputFormat } from "./output.js";
|
|
4
5
|
import { celCommand } from "./commands/cel.js";
|
|
5
6
|
import { checkCommand } from "./commands/check.js";
|
|
6
7
|
import { installCommand } from "./commands/install.js";
|
|
@@ -47,6 +48,16 @@ cli
|
|
|
47
48
|
default: true,
|
|
48
49
|
describe: "Persist the analysis/validator cache to disk. Use --no-cache-write for an ephemeral, read-only run (validates in-memory, reads the baked cache but never writes it).",
|
|
49
50
|
})
|
|
51
|
+
.option("output", {
|
|
52
|
+
alias: "o",
|
|
53
|
+
type: "string",
|
|
54
|
+
choices: OUTPUT_FORMATS,
|
|
55
|
+
default: "text",
|
|
56
|
+
describe: "Output format for the CLI's own output. `json` is a machine contract and never carries colour. Note `telo run` streams the app's stdout/stderr through untouched — the app picks its own encoding via its `logging:` block.",
|
|
57
|
+
})
|
|
58
|
+
// Runs before any handler, so a call site deep inside a command reaches the
|
|
59
|
+
// same decision without the format being threaded through every signature.
|
|
60
|
+
.middleware((argv) => configureOutput(parseOutputFormat(argv.output)), true)
|
|
50
61
|
.demandCommand(1, "Please specify a command or path to run")
|
|
51
62
|
.strict()
|
|
52
63
|
.help()
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1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,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC;KAC3E,aAAa,CAAC,CAAC,EAAE,yCAAyC,CAAC;KAC3D,MAAM,EAAE;KACR,IAAI,EAAE;KACN,OAAO,EAAE;KACT,KAAK,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel.d.ts","sourceRoot":"","sources":["../../src/commands/cel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cel.d.ts","sourceRoot":"","sources":["../../src/commands/cel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAgFlC,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAkC5C"}
|
package/dist/commands/cel.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { buildCelEnvironment, celFunctionCatalog } from "@telorun/templating";
|
|
2
|
-
import { nodeCelHandlers } from "@telorun/kernel";
|
|
3
|
-
|
|
4
|
-
const bigintReplacer = (_k, v) => (typeof v === "bigint" ? Number(v) : v);
|
|
2
|
+
import { enableBigIntJson, nodeCelHandlers } from "@telorun/kernel";
|
|
3
|
+
import { output } from "../output.js";
|
|
5
4
|
function printFunctions(asJson) {
|
|
6
5
|
const catalog = celFunctionCatalog();
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const out = output();
|
|
7
|
+
// `--json` predates the global flag and is an alias for it. The catalog array
|
|
8
|
+
// IS the contract, so it is emitted bare rather than inside an envelope.
|
|
9
|
+
if (asJson || out.isJson) {
|
|
10
|
+
out.document(catalog);
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
13
|
const byCategory = new Map();
|
|
@@ -15,26 +17,37 @@ function printFunctions(asJson) {
|
|
|
15
17
|
byCategory.set(fn.category, list);
|
|
16
18
|
}
|
|
17
19
|
for (const [category, fns] of byCategory) {
|
|
18
|
-
|
|
20
|
+
out.line(`\n${category}`);
|
|
19
21
|
for (const fn of fns) {
|
|
20
22
|
const tags = [
|
|
21
23
|
fn.hostBacked ? "host" : null,
|
|
22
24
|
fn.deterministic ? null : "non-deterministic",
|
|
23
25
|
].filter(Boolean);
|
|
24
26
|
const suffix = tags.length ? ` [${tags.join(", ")}]` : "";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
out.line(` ${fn.signature}${suffix}`);
|
|
28
|
+
out.line(` ${fn.summary}`);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
out.line();
|
|
30
32
|
}
|
|
31
33
|
function evalExpression(expr, contextJson, asJson) {
|
|
34
|
+
// The one command that evaluates CEL without a kernel, so it installs the
|
|
35
|
+
// int64 JSON encoding itself — `telo cel eval --json 'size([1,2,3])'` has to
|
|
36
|
+
// print what the same expression produces in a run. Every other path reaches
|
|
37
|
+
// it through `boot()`, which is what keeps the CLI and an embedding Node app
|
|
38
|
+
// identical: hosting a kernel is the only thing that installs it.
|
|
39
|
+
enableBigIntJson();
|
|
40
|
+
const out = output();
|
|
32
41
|
let context;
|
|
33
42
|
try {
|
|
34
43
|
context = contextJson ? JSON.parse(contextJson) : {};
|
|
35
44
|
}
|
|
36
45
|
catch (err) {
|
|
37
|
-
|
|
46
|
+
const message = `Invalid --context JSON: ${err instanceof Error ? err.message : String(err)}`;
|
|
47
|
+
// Prose on stderr plus a non-zero exit — never an envelope on stdout.
|
|
48
|
+
// stdout is the document, and an error object there would be
|
|
49
|
+
// indistinguishable from a CEL expression that evaluated to one.
|
|
50
|
+
out.errLine(message);
|
|
38
51
|
process.exit(1);
|
|
39
52
|
}
|
|
40
53
|
// Real Node handlers so host-backed functions (sha256, base64, …) behave
|
|
@@ -45,14 +58,20 @@ function evalExpression(expr, contextJson, asJson) {
|
|
|
45
58
|
result = env.parse(expr)(context);
|
|
46
59
|
}
|
|
47
60
|
catch (err) {
|
|
48
|
-
|
|
61
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
62
|
+
// Prose on stderr plus a non-zero exit — never an envelope on stdout.
|
|
63
|
+
// stdout is the document, and an error object there would be
|
|
64
|
+
// indistinguishable from a CEL expression that evaluated to one.
|
|
65
|
+
out.errLine(message);
|
|
49
66
|
process.exit(1);
|
|
50
67
|
}
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
// The evaluated value IS the contract — emitted bare, exactly as `--json`
|
|
69
|
+
// already did, so the int64 encoding installed above stays observable.
|
|
70
|
+
if (asJson || out.isJson) {
|
|
71
|
+
out.document(result);
|
|
53
72
|
}
|
|
54
73
|
else {
|
|
55
|
-
|
|
74
|
+
out.line(String(typeof result === "bigint" ? result.toString() : result));
|
|
56
75
|
}
|
|
57
76
|
}
|
|
58
77
|
export function celCommand(yargs) {
|
package/dist/commands/cel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel.js","sourceRoot":"","sources":["../../src/commands/cel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAwB,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cel.js","sourceRoot":"","sources":["../../src/commands/cel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAwB,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,SAAS,cAAc,CAAC,MAAe;IACrC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,8EAA8E;IAC9E,yEAAyE;IACzE,IAAI,MAA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C,IAAI,CAAC,IAAI,CAAC,CACnB,CACJ;SACA,aAAa,CAAC,CAAC,EAAE,6CAA6C,CAAC,CACnE,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AA+PlC,wBAAsB,KAAK,CAAC,IAAI,EAAE;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EhB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAoB9C"}
|
package/dist/commands/check.js
CHANGED
|
@@ -6,7 +6,8 @@ import { defaultTransportRegistry } from "@telorun/kernel/transports";
|
|
|
6
6
|
import * as fs from "fs/promises";
|
|
7
7
|
import * as path from "path";
|
|
8
8
|
import { pathToFileURL } from "url";
|
|
9
|
-
import { createLogger, formatAnalysisDiagnostics, formatDiagnostics } from "../logger.js";
|
|
9
|
+
import { createLogger, formatAnalysisDiagnostics, formatDiagnostics, } from "../logger.js";
|
|
10
|
+
import { outErrLine, output } from "../output.js";
|
|
10
11
|
import { RecordingCacheSource, readOriginDigests, revalidateMutableOciRefs, writeOriginDigests, } from "../manifest-freshness.js";
|
|
11
12
|
const DEFAULT_REGISTRY_URL = "https://registry.telo.run";
|
|
12
13
|
function cacheTargetFor(entryPath) {
|
|
@@ -70,7 +71,7 @@ async function dropStaleEntry(file, session, log) {
|
|
|
70
71
|
await fs.rm(file, { force: true });
|
|
71
72
|
}
|
|
72
73
|
catch (err) {
|
|
73
|
-
|
|
74
|
+
outErrLine(`${log.err.warn(`[manifest-cache] could not remove stale entry ${file}: ${err instanceof Error ? err.message : String(err)}`)}\n`);
|
|
74
75
|
}
|
|
75
76
|
session.loader.forget(pathToFileURL(file).href);
|
|
76
77
|
for (const recorder of session.recorders) {
|
|
@@ -110,6 +111,7 @@ knownDigests, log) {
|
|
|
110
111
|
return {
|
|
111
112
|
errorCount: 0,
|
|
112
113
|
warnCount: 0,
|
|
114
|
+
diagnostics: [],
|
|
113
115
|
staleFiles: freshness.staleFiles,
|
|
114
116
|
digests: freshness.digests,
|
|
115
117
|
};
|
|
@@ -141,7 +143,7 @@ knownDigests, log) {
|
|
|
141
143
|
await writeOriginDigests(cacheTarget.manifestsDir, digests);
|
|
142
144
|
}
|
|
143
145
|
catch (err) {
|
|
144
|
-
|
|
146
|
+
outErrLine(`${log.err.warn(`[manifest-cache] write failed: ${err instanceof Error ? err.message : String(err)}`)}\n`);
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
return { ...counts, staleFiles: [], digests };
|
|
@@ -150,8 +152,25 @@ knownDigests, log) {
|
|
|
150
152
|
const sourceLine = err.sourceLine;
|
|
151
153
|
const displayPath = isUrl ? entryPath : path.relative(process.cwd(), entryPath);
|
|
152
154
|
const loc = sourceLine !== undefined ? `:${sourceLine + 1}` : "";
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
156
|
+
formatDiagnostics([{ message }], log, `${displayPath}${loc}`);
|
|
157
|
+
// A load failure is a diagnostic like any other to a `-o json` consumer;
|
|
158
|
+
// dropping it there would make the payload disagree with the exit code.
|
|
159
|
+
return {
|
|
160
|
+
errorCount: 1,
|
|
161
|
+
warnCount: 0,
|
|
162
|
+
diagnostics: [
|
|
163
|
+
{
|
|
164
|
+
file: displayPath,
|
|
165
|
+
line: sourceLine !== undefined ? sourceLine + 1 : 1,
|
|
166
|
+
column: 1,
|
|
167
|
+
severity: "error",
|
|
168
|
+
message,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
staleFiles: [],
|
|
172
|
+
digests: new Map(),
|
|
173
|
+
};
|
|
155
174
|
}
|
|
156
175
|
}
|
|
157
176
|
export async function check(argv) {
|
|
@@ -168,6 +187,7 @@ export async function check(argv) {
|
|
|
168
187
|
const session = openSession([...cacheTargets.values()], registryUrl);
|
|
169
188
|
let totalErrors = 0;
|
|
170
189
|
let totalWarns = 0;
|
|
190
|
+
const allDiagnostics = [];
|
|
171
191
|
for (const p of argv.paths) {
|
|
172
192
|
const cacheTarget = cacheTargetFor(resolveEntryPath(p));
|
|
173
193
|
let outcome = await checkOne(p, registryUrl, session, cacheTarget, cacheWrite, null, log);
|
|
@@ -184,9 +204,11 @@ export async function check(argv) {
|
|
|
184
204
|
}
|
|
185
205
|
totalErrors += outcome.errorCount;
|
|
186
206
|
totalWarns += outcome.warnCount;
|
|
207
|
+
allDiagnostics.push(...outcome.diagnostics);
|
|
187
208
|
}
|
|
209
|
+
const out = output();
|
|
188
210
|
if (totalErrors === 0 && totalWarns === 0) {
|
|
189
|
-
|
|
211
|
+
out.line(log.ok("✓") + " No issues found");
|
|
190
212
|
}
|
|
191
213
|
else {
|
|
192
214
|
const parts = [];
|
|
@@ -194,10 +216,23 @@ export async function check(argv) {
|
|
|
194
216
|
parts.push(log.error(`${totalErrors} error${totalErrors !== 1 ? "s" : ""}`));
|
|
195
217
|
if (totalWarns > 0)
|
|
196
218
|
parts.push(log.warn(`${totalWarns} warning${totalWarns !== 1 ? "s" : ""}`));
|
|
197
|
-
|
|
219
|
+
out.line(`\n${parts.join(", ")}`);
|
|
198
220
|
}
|
|
221
|
+
// Emitted even when clean: an empty `diagnostics` array is the answer, and a
|
|
222
|
+
// consumer must not have to treat "no output" as success.
|
|
223
|
+
out.emit({
|
|
224
|
+
ok: totalErrors === 0,
|
|
225
|
+
errorCount: totalErrors,
|
|
226
|
+
warnCount: totalWarns,
|
|
227
|
+
diagnostics: allDiagnostics,
|
|
228
|
+
});
|
|
229
|
+
// `process.exitCode`, not `process.exit()`: the structured payload was just
|
|
230
|
+
// written, and on a pipe `write` is asynchronous while `exit` does not flush. A
|
|
231
|
+
// large diagnostic set exceeds the 64 KB pipe buffer, and truncated JSON is a
|
|
232
|
+
// parse failure for the one consumer this format exists for. Returning lets
|
|
233
|
+
// the event loop drain.
|
|
199
234
|
if (totalErrors > 0)
|
|
200
|
-
process.
|
|
235
|
+
process.exitCode = 1;
|
|
201
236
|
}
|
|
202
237
|
export function checkCommand(yargs) {
|
|
203
238
|
return yargs.command("check <paths..>", "Check one or more Telo manifests for errors without running them", (y) => y
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,wBAAwB,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,EAAE,CAAC,CAAC,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,6EAA6E;IAC7E,0DAA0D;IAC1D,GAAG,CAAC,IAAI,CAAC;QACP,EAAE,EAAE,WAAW,KAAK,CAAC;QACrB,UAAU,EAAE,WAAW;QACvB,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,cAAc;KAC5B,CAAC,CAAC;IAEH,4EAA4E;IAC5E,gFAAgF;IAChF,8EAA8E;IAC9E,4EAA4E;IAC5E,wBAAwB;IACxB,IAAI,WAAW,GAAG,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAW;IACtC,OAAO,KAAK,CAAC,OAAO,CAClB,iBAAiB,EACjB,kEAAkE,EAClE,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC;SACE,UAAU,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,4EAA4E;QACtF,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,MAAM,CAAC,cAAc,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,qEAAqE;KAChF,CAAC,EACN,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,IAAW,CAAC,CAAC;IAC3B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAsPlC,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsChB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA4BhD"}
|
package/dist/commands/install.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as path from "path";
|
|
|
4
4
|
import { pathToFileURL } from "url";
|
|
5
5
|
import { describePlatformTarget, parsePlatformTarget, warmModuleLayers, } from "../bundle/warm-layers.js";
|
|
6
6
|
import { createLogger } from "../logger.js";
|
|
7
|
+
import { outEmit, outErrLine, outLine } from "../output.js";
|
|
7
8
|
const DEFAULT_REGISTRY_URL = "https://registry.telo.run";
|
|
8
9
|
/**
|
|
9
10
|
* Walks the manifest graph (following imports), collects every
|
|
@@ -62,10 +63,10 @@ async function warmAnalysisCache(entryPath, entryDir, registryUrl, log, cacheRoo
|
|
|
62
63
|
],
|
|
63
64
|
});
|
|
64
65
|
await kernel.load(entryPath, { analyzeOnly: true, cacheDir: cacheRoot });
|
|
65
|
-
|
|
66
|
+
outLine(` ${log.ok("✓")} warmed analysis cache in ${log.dim(path.relative(process.cwd(), manifestsDir))}`);
|
|
66
67
|
}
|
|
67
68
|
catch (err) {
|
|
68
|
-
|
|
69
|
+
outErrLine(` ${log.err.warn("⚠")} analysis cache not warmed: ` +
|
|
69
70
|
(err instanceof Error ? err.message : String(err)));
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -99,7 +100,7 @@ async function installOne(inputPath, registryUrl, platform, log) {
|
|
|
99
100
|
manifests = flattenForAnalyzer(graph);
|
|
100
101
|
}
|
|
101
102
|
catch (err) {
|
|
102
|
-
|
|
103
|
+
outErrLine(`${displayPath} ${log.err.error("error")} ` +
|
|
103
104
|
(err instanceof Error ? err.message : String(err)));
|
|
104
105
|
return false;
|
|
105
106
|
}
|
|
@@ -119,31 +120,31 @@ async function installOne(inputPath, registryUrl, platform, log) {
|
|
|
119
120
|
try {
|
|
120
121
|
const written = await writeManifestCache(graph, entryDir, registryUrl, manifestsDir);
|
|
121
122
|
if (written.length > 0) {
|
|
122
|
-
|
|
123
|
+
outLine(` ${log.ok("✓")} cached ${written.length} manifest${written.length !== 1 ? "s" : ""} to ${log.dim(path.relative(process.cwd(), manifestsDir))}`);
|
|
123
124
|
}
|
|
124
125
|
// Warm every layer this target could need. `run` fetches lazily, so this
|
|
125
126
|
// is purely so a later run (or a baked image) needs no network.
|
|
126
|
-
const warmed = await warmModuleLayers(graph, entryDir, registryUrl, manifestsDir, platform, (msg) =>
|
|
127
|
+
const warmed = await warmModuleLayers(graph, entryDir, registryUrl, manifestsDir, platform, (msg) => outErrLine(` ${log.err.warn("⚠")} ${msg}`));
|
|
127
128
|
moduleArtifacts = warmed.artifacts;
|
|
128
129
|
if (warmed.materialized > 0) {
|
|
129
|
-
|
|
130
|
+
outLine(` ${log.ok("✓")} materialized ${warmed.materialized} module layer${warmed.materialized !== 1 ? "s" : ""} ` +
|
|
130
131
|
`for ${log.dim(describePlatformTarget(platform))}`);
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
catch (err) {
|
|
134
|
-
|
|
135
|
+
outErrLine(`${displayPath} ${log.err.error("error")} failed to write manifest cache: ` +
|
|
135
136
|
(err instanceof Error ? err.message : String(err)));
|
|
136
137
|
return false;
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
const jobs = collectControllerJobs(manifests);
|
|
140
141
|
if (jobs.length === 0) {
|
|
141
|
-
|
|
142
|
+
outLine(log.ok("✓") + ` ${displayPath}: no controllers to install`);
|
|
142
143
|
if (entryDir && cacheRoot)
|
|
143
144
|
await warmAnalysisCache(entryPath, entryDir, registryUrl, log, cacheRoot);
|
|
144
145
|
return true;
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
+
outLine(`Installing ${jobs.length} controller${jobs.length !== 1 ? "s" : ""} for ${log.dim(displayPath)}`);
|
|
147
148
|
// The install root is anchored at the entry manifest's directory, mirroring
|
|
148
149
|
// how `kernel.load(...)` records the entry URL at run time. Every controller
|
|
149
150
|
// — registry or `local_path` — resolves through `<entry-dir>/.telo/npm/`,
|
|
@@ -165,27 +166,27 @@ async function installOne(inputPath, registryUrl, platform, log) {
|
|
|
165
166
|
const job = jobs[i];
|
|
166
167
|
const result = results[i];
|
|
167
168
|
if (result.status === "fulfilled") {
|
|
168
|
-
|
|
169
|
+
outLine(` ${log.ok("✓")} ${job.label}`);
|
|
169
170
|
}
|
|
170
171
|
else {
|
|
171
172
|
failed++;
|
|
172
173
|
const reason = result.reason;
|
|
173
174
|
const msg = reason instanceof Error ? reason.message : String(reason);
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
outErrLine(` ${log.err.error("✗")} ${job.label}`);
|
|
176
|
+
outErrLine(` ${log.err.dim(msg)}`);
|
|
176
177
|
for (const ref of job.definitions) {
|
|
177
|
-
|
|
178
|
+
outErrLine(` ${log.err.dim(`referenced by ${ref.kind} ${ref.name}`)}`);
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
const elapsed = ((Date.now() - started) / 1000).toFixed(1);
|
|
182
183
|
if (failed === 0) {
|
|
183
|
-
|
|
184
|
+
outLine(`\n${log.ok("✓")} ${jobs.length} installed in ${elapsed}s`);
|
|
184
185
|
if (entryDir && cacheRoot)
|
|
185
186
|
await warmAnalysisCache(entryPath, entryDir, registryUrl, log, cacheRoot);
|
|
186
187
|
return true;
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
outLine(`\n${log.error(`${failed} failed`)}, ${jobs.length - failed} installed in ${elapsed}s`);
|
|
189
190
|
return false;
|
|
190
191
|
}
|
|
191
192
|
export async function install(argv) {
|
|
@@ -197,7 +198,7 @@ export async function install(argv) {
|
|
|
197
198
|
platform = parsePlatformTarget(argv.platform);
|
|
198
199
|
}
|
|
199
200
|
catch (err) {
|
|
200
|
-
|
|
201
|
+
outErrLine(log.err.error("error") + ` ${err instanceof Error ? err.message : String(err)}`);
|
|
201
202
|
process.exit(1);
|
|
202
203
|
}
|
|
203
204
|
// Same fallback chain as `telo run`: --registry-url > TELO_REGISTRY_URL >
|
|
@@ -207,13 +208,22 @@ export async function install(argv) {
|
|
|
207
208
|
// different registry never reuses this one's cached bytes.
|
|
208
209
|
const registryUrl = argv.registryUrl ?? process.env.TELO_REGISTRY_URL ?? DEFAULT_REGISTRY_URL;
|
|
209
210
|
let failed = false;
|
|
211
|
+
const installed = [];
|
|
212
|
+
const failures = [];
|
|
210
213
|
for (const p of argv.paths) {
|
|
211
214
|
const ok = await installOne(p, registryUrl, platform, log);
|
|
215
|
+
(ok ? installed : failures).push(p);
|
|
212
216
|
if (!ok)
|
|
213
217
|
failed = true;
|
|
214
218
|
}
|
|
219
|
+
outEmit({ ok: !failed, installed, failed: failures });
|
|
220
|
+
// `process.exitCode`, not `process.exit()`: the structured payload was just
|
|
221
|
+
// written, and on a pipe `write` is asynchronous while `exit` does not flush. A
|
|
222
|
+
// large diagnostic set exceeds the 64 KB pipe buffer, and truncated JSON is a
|
|
223
|
+
// parse failure for the one consumer this format exists for. Returning lets
|
|
224
|
+
// the event loop drain.
|
|
215
225
|
if (failed)
|
|
216
|
-
process.
|
|
226
|
+
process.exitCode = 1;
|
|
217
227
|
}
|
|
218
228
|
export function installCommand(yargs) {
|
|
219
229
|
return yargs.command("install <paths..>", "Pre-download all controllers referenced by one or more Telo manifests into the local cache", (y) => y
|