@scenar/cli 0.1.5 → 0.1.7

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.
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Lightweight bundle shape for CLI use. Mirrors the @scenar/core
3
+ * ScenarioBundle interface but uses plain objects (the CLI does not
4
+ * import @scenar/core at runtime to stay lightweight).
5
+ */
6
+ export interface CliBundle {
7
+ id: string;
8
+ steps: Array<{
9
+ delayMs: number;
10
+ narration?: string;
11
+ }>;
12
+ narrationManifest?: {
13
+ steps: Array<{
14
+ src: string;
15
+ durationMs: number;
16
+ } | null>;
17
+ };
18
+ }
19
+ /**
20
+ * Load a scenario bundle from a directory. Expects:
21
+ * <dir>/steps.ts — required (step definitions)
22
+ * <dir>/narration/manifest.json — optional (narration manifest)
23
+ *
24
+ * The scenario id defaults to the directory base name.
25
+ */
26
+ export declare function loadBundle(dir: string): Promise<CliBundle>;
27
+ //# sourceMappingURL=load-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-bundle.d.ts","sourceRoot":"","sources":["../../../src/util/load-bundle.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC,CAAC;KAC1D,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAoBhE"}
@@ -0,0 +1,30 @@
1
+ import { readFile, access } from "node:fs/promises";
2
+ import { join, basename } from "node:path";
3
+ import { loadStepsFromTs } from "./load-ts.js";
4
+ /**
5
+ * Load a scenario bundle from a directory. Expects:
6
+ * <dir>/steps.ts — required (step definitions)
7
+ * <dir>/narration/manifest.json — optional (narration manifest)
8
+ *
9
+ * The scenario id defaults to the directory base name.
10
+ */
11
+ export async function loadBundle(dir) {
12
+ const stepsPath = join(dir, "steps.ts");
13
+ const manifestPath = join(dir, "narration", "manifest.json");
14
+ const steps = await loadStepsFromTs(stepsPath);
15
+ let narrationManifest;
16
+ try {
17
+ await access(manifestPath);
18
+ const raw = await readFile(manifestPath, "utf-8");
19
+ narrationManifest = JSON.parse(raw);
20
+ }
21
+ catch {
22
+ // No manifest — scenario plays without narration.
23
+ }
24
+ return {
25
+ id: basename(dir),
26
+ steps,
27
+ narrationManifest,
28
+ };
29
+ }
30
+ //# sourceMappingURL=load-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-bundle.js","sourceRoot":"","sources":["../../../src/util/load-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAe/C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IAE7D,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,SAAS,CAAC,CAAC;IAE/C,IAAI,iBAAiD,CAAC;IACtD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAClD,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;IACpD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC;QACjB,KAAK;QACL,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { readFile, access } from "node:fs/promises";
2
+ import { join, basename } from "node:path";
3
+ import { loadStepsFromTs } from "./load-ts.js";
4
+
5
+ /**
6
+ * Lightweight bundle shape for CLI use. Mirrors the @scenar/core
7
+ * ScenarioBundle interface but uses plain objects (the CLI does not
8
+ * import @scenar/core at runtime to stay lightweight).
9
+ */
10
+ export interface CliBundle {
11
+ id: string;
12
+ steps: Array<{ delayMs: number; narration?: string }>;
13
+ narrationManifest?: {
14
+ steps: Array<{ src: string; durationMs: number } | null>;
15
+ };
16
+ }
17
+
18
+ /**
19
+ * Load a scenario bundle from a directory. Expects:
20
+ * <dir>/steps.ts — required (step definitions)
21
+ * <dir>/narration/manifest.json — optional (narration manifest)
22
+ *
23
+ * The scenario id defaults to the directory base name.
24
+ */
25
+ export async function loadBundle(dir: string): Promise<CliBundle> {
26
+ const stepsPath = join(dir, "steps.ts");
27
+ const manifestPath = join(dir, "narration", "manifest.json");
28
+
29
+ const steps = await loadStepsFromTs(stepsPath);
30
+
31
+ let narrationManifest: CliBundle["narrationManifest"];
32
+ try {
33
+ await access(manifestPath);
34
+ const raw = await readFile(manifestPath, "utf-8");
35
+ narrationManifest = JSON.parse(raw) as CliBundle["narrationManifest"];
36
+ } catch {
37
+ // No manifest — scenario plays without narration.
38
+ }
39
+
40
+ return {
41
+ id: basename(dir),
42
+ steps,
43
+ narrationManifest,
44
+ };
45
+ }