@loadmap/cli 0.0.0-stage → 0.1.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jaime Rojas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @loadmap/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```bash
4
+ npx @loadmap/cli check shop.loadmap # exit 1 when an expect line fails; GitHub annotations under Actions
5
+ npx @loadmap/cli record shop.loadmap --out shop.gif --caption
6
+ npx @loadmap/cli record http://localhost:5173/ --out poster.png --poster
7
+ ```
8
+
9
+ `loadmap check` compiles each `.loadmap` and tests its `expect` lines on the pessimistic edge (every capacity at its
10
+ low bound). `loadmap record` draws a `.loadmap` (or opens a page that calls `expose()` from `@loadmap/export`) in
11
+ headless Chromium and records it on a fixed clock: the same options give the same file. Recording needs Chromium
12
+ once: `npx playwright install chromium`. `loadmap --help` lists every option.
13
+ Docs: https://jaim3r0jas.github.io/loadmap/ · MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { n as main } from "./src-B81_QU8o.js";
3
+ // src/bin.ts
4
+ main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
5
+ console.error(err instanceof Error ? err.message : err);
6
+ process.exit(1);
7
+ });
8
+ export {};
@@ -0,0 +1,66 @@
1
+ /** A range of the source, as offsets: `from` inclusive, `to` exclusive. */
2
+ interface Span {
3
+ from: number;
4
+ to: number;
5
+ }
6
+ interface Diagnostic extends Span {
7
+ severity: 'error' | 'warning';
8
+ message: string;
9
+ /** 1-based, like an editor shows them. */
10
+ line: number;
11
+ column: number;
12
+ /** A short suggestion shown under the mark: "did you mean "orders"?". */
13
+ hint?: string;
14
+ }
15
+ interface CheckOptions {
16
+ log?: (s: string) => void;
17
+ /** Where GITHUB_ACTIONS is read from: annotations are the default there. */
18
+ env?: Readonly<Record<string, string | undefined>>;
19
+ }
20
+ /**
21
+ * `loadmap check`: compiles each definition and tests its expect lines. Resolves to the exit code: 1 when a
22
+ * definition has an error or an expectation fails, 2 for a usage mistake, 0 when everything holds.
23
+ */
24
+ export declare function check(argv: string[], o?: CheckOptions): Promise<number>;
25
+ /**
26
+ * A diagnostic as a GitHub Actions workflow command: an annotation on its line of the file in the pull request.
27
+ * https://docs.github.com/actions/reference/workflow-commands-for-github-actions
28
+ */
29
+ export declare function github(d: Diagnostic, file: string, source: string): string;
30
+ export declare const USAGE = "loadmap check <file.loadmap>… [--format text|github]\nloadmap record <url | file.loadmap> --out <file.gif|.webm|.mp4|.png|.svg> [options]\n\ncheck compiles each definition and tests its expect lines on the pessimistic edge (every capacity at its low\nbound). It exits 1 when a definition has an error or an expectation fails, 0 when everything holds.\n\n --format <f> text, or github to add annotations on the lines (the default under GitHub Actions)\n\nrecord opens the page in headless Chromium, finds the loadmap it exposes (expose() from @loadmap/export) and\nrecords it on a fixed clock, so the same options give the same file. A .loadmap file is drawn by the viewer that\ncomes with the command.\n\n --out <file> the extension picks the format: gif, webm, mp4, png or svg\n --script <file.json> [{ \"at\": 0, \"set\": { \"load\": 5 } }, { \"at\": 3, \"scenario\": \"Proposed\" }, …]\n or { \"seconds\", \"fps\", \"script\": […] }\n --scenario <label> start from a scenario's values (--set goes on top)\n --set <key=value> a value before recording starts; repeatable (--set load=30 --set pods=6)\n --caption the title, scenario and load above the board, the verdict below it\n --story play the definition's story, a step at a time (with --caption, its text below the board)\n --poster with .png: the board, the verdict, the limits and the scenarios compared\n --seconds <n> length of a video or GIF (default 8, or the script's)\n --fps <n> frames per second (default 30; GIF 15, at most 50)\n --scale <n> pixels per diagram unit (default 1, PNG 2)\n --seed <n> the sim's seed (default 1)\n --name <name> which exposed loadmap, when the page has several (default \"default\")\n --width <px> the browser window (default 1280; below 640 the diagram runs top to bottom)\n --color-scheme <s> light or dark, for a page that follows the system theme (default light)";
31
+ export interface RecordArgs {
32
+ /** A page that calls expose(); empty with `file`. */
33
+ url: string;
34
+ /** A .loadmap definition to draw instead of a page. */
35
+ file?: string;
36
+ out: string;
37
+ script?: {
38
+ at: number;
39
+ scenario?: string;
40
+ set?: Record<string, string | number | boolean>;
41
+ }[];
42
+ scenario?: string;
43
+ set: Record<string, string | number | boolean>;
44
+ caption: boolean;
45
+ poster: boolean;
46
+ story: boolean;
47
+ seconds?: number;
48
+ fps?: number;
49
+ scale?: number;
50
+ seed?: number;
51
+ name: string;
52
+ width: number;
53
+ colorScheme: 'light' | 'dark';
54
+ }
55
+ /** Runs the command line; resolves to the exit code. */
56
+ export declare function main(argv: string[], log?: (s: string) => void): Promise<number>;
57
+ export declare function parseRecord(argv: string[]): Promise<RecordArgs>;
58
+ /**
59
+ * Records in a fresh headless Chromium and returns the file's bytes. A .loadmap file is compiled here first (its
60
+ * errors are thrown, formatted), then drawn by the viewer in `o.viewer`: by default the one the build puts in
61
+ * dist/viewer.
62
+ */
63
+ export declare function record(a: RecordArgs, o?: {
64
+ viewer?: string;
65
+ }): Promise<Buffer>;
66
+ export type { CheckOptions };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { t as USAGE, a as check, o as github, n as main, r as parseRecord, i as record } from "./src-B81_QU8o.js";