@venn-lang/cli 0.1.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/LICENSE +21 -0
- package/README.md +284 -0
- package/dist/bin/venn.mjs +16 -0
- package/dist/cli.mjs +56378 -0
- package/dist/index.d.mts +98 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +916 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -0
- package/src/bin/venn.ts +14 -0
- package/src/cli.ts +299 -0
- package/src/commands/build.ts +97 -0
- package/src/commands/check.ts +143 -0
- package/src/commands/deps.ts +228 -0
- package/src/commands/fmt.ts +55 -0
- package/src/commands/index.ts +2 -0
- package/src/commands/inside-workspace.ts +20 -0
- package/src/commands/list.ts +53 -0
- package/src/commands/new.ts +66 -0
- package/src/commands/run.ts +149 -0
- package/src/commands/script.ts +127 -0
- package/src/commands/upgrade.ts +86 -0
- package/src/commands/verify-plugin.ts +35 -0
- package/src/index.ts +7 -0
- package/src/manifest/index.ts +2 -0
- package/src/manifest/load-env.ts +70 -0
- package/src/manifest/load-manifest.ts +42 -0
- package/src/project/command-targets.ts +53 -0
- package/src/project/index.ts +9 -0
- package/src/project/resolve-targets.ts +70 -0
- package/src/project/select-packages.ts +37 -0
- package/src/project/targets-or-exit.ts +28 -0
- package/src/reporters/colors.ts +17 -0
- package/src/reporters/dot-sink.ts +18 -0
- package/src/reporters/error-line.ts +14 -0
- package/src/reporters/index.ts +9 -0
- package/src/reporters/junit-sink.ts +39 -0
- package/src/reporters/ndjson-stdout.ts +13 -0
- package/src/reporters/pick-reporter.ts +28 -0
- package/src/reporters/pretty/diff-lines.ts +53 -0
- package/src/reporters/pretty/index.ts +1 -0
- package/src/reporters/pretty/pretty-reporter.ts +122 -0
- package/src/reporters/pretty/pretty.types.ts +29 -0
- package/src/reporters/pretty/render.ts +88 -0
- package/src/reporters/problem-reporter.ts +13 -0
- package/src/reporters/problem-sink.ts +20 -0
- package/src/reporters/reporter.types.ts +21 -0
- package/src/run/collect-files.ts +43 -0
- package/src/run/ending.types.ts +17 -0
- package/src/run/exit-code.ts +15 -0
- package/src/run/node-io.ts +27 -0
- package/src/run/npm-loader.ts +41 -0
- package/src/run/package-types.ts +66 -0
- package/src/run/run-file.ts +106 -0
- package/src/run/should-leave.ts +11 -0
- package/src/run/step-titles.ts +61 -0
- package/src/shutdown/create-leave.ts +42 -0
- package/src/shutdown/create-shutdown.ts +34 -0
- package/src/shutdown/index.ts +7 -0
- package/src/shutdown/install-exit-hook.ts +21 -0
- package/src/shutdown/install-fault-hooks.ts +30 -0
- package/src/shutdown/install-hooks.ts +36 -0
- package/src/shutdown/install-signal-hooks.ts +26 -0
- package/src/shutdown/shutdown.types.ts +20 -0
- package/src/title/index.ts +2 -0
- package/src/title/program-title.ts +15 -0
- package/src/title/set-program-title.ts +15 -0
- package/src/upgrade/index.ts +6 -0
- package/src/upgrade/install-site.ts +70 -0
- package/src/upgrade/latest-version.ts +50 -0
- package/src/upgrade/upgrade-command.ts +32 -0
- package/src/upgrade/upgrade-plan.ts +36 -0
- package/src/upgrade/upgrade.types.ts +17 -0
- package/src/upgrade/version.ts +21 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { HttpClient, HttpServer } from "@venn-lang/http";
|
|
2
|
+
import { Console, Host } from "@venn-lang/contracts";
|
|
3
|
+
import { CleanupSink, EventSink, ModuleIo, NpmModules, RunFilter, RunResult } from "@venn-lang/runtime";
|
|
4
|
+
import { Problem } from "@venn-lang/core";
|
|
5
|
+
//#region src/commands/run.d.ts
|
|
6
|
+
/** Everything `venn run` accepts. */
|
|
7
|
+
interface RunOptions {
|
|
8
|
+
file: string;
|
|
9
|
+
reporter?: string;
|
|
10
|
+
tags?: string;
|
|
11
|
+
flow?: string;
|
|
12
|
+
step?: string;
|
|
13
|
+
env?: string;
|
|
14
|
+
bail?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* `venn test <file|directory>`: run every matching flow, then report.
|
|
18
|
+
*
|
|
19
|
+
* @param options - The file or directory, the reporter, and the filters.
|
|
20
|
+
* @returns The exit code: whatever a flow's `exit` named, else 0 when nothing
|
|
21
|
+
* failed, else 1. Also 1 when the path holds no `.vn` file.
|
|
22
|
+
*/
|
|
23
|
+
declare function runCommand(options: RunOptions): Promise<number>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/commands/verify-plugin.d.ts
|
|
26
|
+
/**
|
|
27
|
+
* `venn verify-plugin <path>`: import a plugin module, print what it declares,
|
|
28
|
+
* and check its shape.
|
|
29
|
+
*
|
|
30
|
+
* @param args - `path` is the module to import, relative to the working
|
|
31
|
+
* directory or absolute.
|
|
32
|
+
* @returns 0 when the plugin names itself and a namespace, 1 when it does not.
|
|
33
|
+
* @throws Error when the module exports nothing that looks like a plugin.
|
|
34
|
+
*/
|
|
35
|
+
declare function verifyPluginCommand(args: {
|
|
36
|
+
path: string;
|
|
37
|
+
}): Promise<number>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/reporters/ndjson-stdout.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* An event sink that writes each envelope to stdout as one line of NDJSON: the
|
|
42
|
+
* stream a script or a CI job parses.
|
|
43
|
+
*/
|
|
44
|
+
declare function createStdoutSink(): EventSink;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/reporters/problem-reporter.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Print compile-time problems to stderr, one code and title per problem with
|
|
49
|
+
* its source location beneath. The terminal surface of the §16 model.
|
|
50
|
+
*/
|
|
51
|
+
declare function reportProblems(problems: readonly Problem[]): void;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/run/run-file.d.ts
|
|
54
|
+
/** What one `.vn` file amounted to. */
|
|
55
|
+
interface RunFileOutcome {
|
|
56
|
+
/** Everything refused or reported. Empty when the file ran clean. */
|
|
57
|
+
problems: Problem[];
|
|
58
|
+
/** Absent when nothing ran: the parse or the imports stopped it first. */
|
|
59
|
+
result?: RunResult;
|
|
60
|
+
}
|
|
61
|
+
/** The source to run, the implementations behind its ports, and how to run it. */
|
|
62
|
+
interface RunFileArgs {
|
|
63
|
+
source: string;
|
|
64
|
+
uri: string;
|
|
65
|
+
host: Host;
|
|
66
|
+
sink: EventSink;
|
|
67
|
+
httpClient: HttpClient;
|
|
68
|
+
/** Injected when the caller needs to close the servers itself, as `venn run` does. */
|
|
69
|
+
httpServer?: HttpServer;
|
|
70
|
+
console?: Console;
|
|
71
|
+
filter?: RunFilter;
|
|
72
|
+
bail?: boolean;
|
|
73
|
+
env?: Record<string, unknown>;
|
|
74
|
+
io?: ModuleIo;
|
|
75
|
+
/** How an installed package is loaded, when the host can load one. */
|
|
76
|
+
npm?: NpmModules;
|
|
77
|
+
/** Where the program registers what it opened, so the host can close it. */
|
|
78
|
+
cleanup?: CleanupSink;
|
|
79
|
+
/** "test" runs the flows; "script" executes the file top to bottom. */
|
|
80
|
+
mode?: "test" | "script";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Parse and run a `.vn` source with the full stdlib loaded.
|
|
84
|
+
*
|
|
85
|
+
* The HttpClient, HttpServer and Console ports take injected implementations
|
|
86
|
+
* (real in the CLI, fakes in tests); every other port takes the binding
|
|
87
|
+
* `@venn-lang/stdlib` supplies.
|
|
88
|
+
*
|
|
89
|
+
* @param args - The source and its uri, the host and the ports, and how to run
|
|
90
|
+
* it: the filter, the mode, the environment, the module and package loaders.
|
|
91
|
+
* @returns The problems and, when anything ran, the run's result. A failing
|
|
92
|
+
* flow is a `Problem` here, not an exception.
|
|
93
|
+
* @throws Whatever an action or a loaded module let escape the runner.
|
|
94
|
+
*/
|
|
95
|
+
declare function runFile(args: RunFileArgs): Promise<RunFileOutcome>;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { type RunFileOutcome, createStdoutSink, reportProblems, runCommand, runFile, verifyPluginCommand };
|
|
98
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/commands/run.ts","../src/commands/verify-plugin.ts","../src/reporters/ndjson-stdout.ts","../src/reporters/problem-reporter.ts","../src/run/run-file.ts"],"mappings":";;;;;;UAiBiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;iBAkBoB,WAAW,SAAS,aAAa;;;;;;;;;;;;iBC7BjC,oBAAoB;EAAQ;IAAiB;;;;;;;iBCPnD,oBAAoB;;;;;;;iBCApB,eAAe,mBAAmB;;;;UCYjC;;EAEf,UAAU;;EAEV,SAAS;;;UAIM;EACf;EACA;EACA,MAAM;EACN,MAAM;EACN,YAAY;;EAEZ,aAAa;EACb,UAAU;EACV,SAAS;EACT;EACA,MAAM;EACN,KAAK;;EAEL,MAAM;;EAEN,UAAU;;EAEV;;;;;;;;;;;;;;;iBAgBoB,QAAQ,MAAM,cAAc,QAAQ"}
|