miriad-viz 0.9.2 → 0.9.3

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.
@@ -144,12 +144,15 @@ var STEP_FILE_MAP = {
144
144
  // render output is the final video — too large for board
145
145
  };
146
146
  var ALWAYS_SYNC = [".miriad-viz.json"];
147
- async function syncStepOutputs(config, step, dataDir) {
147
+ var OUTPUT_DIR_STEPS = /* @__PURE__ */ new Set(["transform"]);
148
+ async function syncStepOutputs(config, step, dataDir, outputDir) {
149
+ const stepDir = OUTPUT_DIR_STEPS.has(step) && outputDir ? outputDir : dataDir;
148
150
  const files = STEP_FILE_MAP[step] ?? [];
149
151
  const allFiles = [.../* @__PURE__ */ new Set([...files, ...ALWAYS_SYNC])];
150
152
  let synced = 0;
151
153
  for (const file of allFiles) {
152
- const localPath = resolve(dataDir, file);
154
+ const dir = ALWAYS_SYNC.includes(file) ? dataDir : stepDir;
155
+ const localPath = resolve(dir, file);
153
156
  if (!existsSync(localPath)) continue;
154
157
  await syncTextFile(config, localPath, file);
155
158
  synced++;
@@ -169,7 +172,7 @@ async function syncStepOutputs(config, step, dataDir) {
169
172
  console.log(` \u2601 Synced ${synced} file${synced > 1 ? "s" : ""} to board`);
170
173
  }
171
174
  }
172
- async function pullFromBoard(config, dataDir) {
175
+ async function pullFromBoard(config, dataDir, outputDir) {
173
176
  const warnings = [];
174
177
  let pulled = 0;
175
178
  try {
@@ -226,7 +229,7 @@ async function pullFromBoard(config, dataDir) {
226
229
  if (existsSync(progressPath)) {
227
230
  try {
228
231
  const progress = JSON.parse(readFileSync(progressPath, "utf-8"));
229
- const validationWarnings = validateProgressConsistency(progress, dataDir);
232
+ const validationWarnings = validateProgressConsistency(progress, dataDir, outputDir);
230
233
  warnings.push(...validationWarnings);
231
234
  } catch {
232
235
  warnings.push("Failed to parse .miriad-viz.json for consistency check");
@@ -248,7 +251,7 @@ var STEP_REQUIRED_FILES = {
248
251
  "sound-design": ["audio-manifest.json"],
249
252
  transform: ["viz-data.json"]
250
253
  };
251
- function validateProgressConsistency(progress, dataDir) {
254
+ function validateProgressConsistency(progress, dataDir, outputDir) {
252
255
  const warnings = [];
253
256
  const steps = progress.steps;
254
257
  if (!steps) return warnings;
@@ -268,7 +271,8 @@ function validateProgressConsistency(progress, dataDir) {
268
271
  continue;
269
272
  }
270
273
  for (const file of requiredFiles) {
271
- if (!existsSync(resolve(dataDir, file))) {
274
+ const checkDir = OUTPUT_DIR_STEPS.has(step) && outputDir ? outputDir : dataDir;
275
+ if (!existsSync(resolve(checkDir, file))) {
272
276
  warnings.push(`Step '${step}' marked complete but ${file} missing \u2014 resetting to pending`);
273
277
  state.status = "pending";
274
278
  break;
@@ -12,7 +12,7 @@ import {
12
12
  canSync,
13
13
  getBoardSyncConfig,
14
14
  syncStepOutputs
15
- } from "./chunk-UTFBENVA.js";
15
+ } from "./chunk-7BH6QQNB.js";
16
16
  import {
17
17
  markComplete,
18
18
  markError,
package/dist-cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  pullFromBoard,
5
5
  syncStepOutputs,
6
6
  syncTextFile
7
- } from "./chunk-UTFBENVA.js";
7
+ } from "./chunk-7BH6QQNB.js";
8
8
  import {
9
9
  PROGRESS_FILENAME,
10
10
  STEPS,
@@ -1544,7 +1544,11 @@ async function runNext(flags) {
1544
1544
  const syncConfig = getBoardSyncConfig(progress.project.dataDir);
1545
1545
  if (syncConfig) {
1546
1546
  console.log("\n\u2601 Checking board for existing pipeline state...");
1547
- const { pulled, warnings } = await pullFromBoard(syncConfig, dataDir);
1547
+ const { pulled, warnings } = await pullFromBoard(
1548
+ syncConfig,
1549
+ dataDir,
1550
+ resolve3(projectDir, progress.project.outputDir)
1551
+ );
1548
1552
  if (pulled > 0) {
1549
1553
  console.log(` \u2713 Pulled ${pulled} file${pulled > 1 ? "s" : ""} from board`);
1550
1554
  if (existsSync3(progressPath)) {
@@ -1643,8 +1647,9 @@ async function runNext(flags) {
1643
1647
  const syncConfig = getBoardSyncConfig(result.progress.project.dataDir);
1644
1648
  if (syncConfig) {
1645
1649
  const dataDir2 = resolve3(projectDir, result.progress.project.dataDir);
1650
+ const outputDir = resolve3(projectDir, result.progress.project.outputDir);
1646
1651
  if (result.step && (result.action === "completed_and_chained" || result.action === "creative_stop")) {
1647
- await syncStepOutputs(syncConfig, result.step, dataDir2);
1652
+ await syncStepOutputs(syncConfig, result.step, dataDir2, outputDir);
1648
1653
  } else {
1649
1654
  const progressPath = resolve3(projectDir, ".miriad-viz.json");
1650
1655
  if (existsSync3(progressPath)) {
@@ -1690,7 +1695,7 @@ async function main() {
1690
1695
  }
1691
1696
  case "extract": {
1692
1697
  const { projectDir, progress } = requireProject();
1693
- const { runExtract } = await import("./extract-5JGICL3V.js");
1698
+ const { runExtract } = await import("./extract-6XRQDMNC.js");
1694
1699
  await runExtract({
1695
1700
  projectDir,
1696
1701
  progress,
@@ -1711,7 +1716,7 @@ async function main() {
1711
1716
  case "transform": {
1712
1717
  const { projectDir, progress } = requireProject();
1713
1718
  const { parseDuration } = await import("./parse-duration-NVLCEFAF.js");
1714
- const { runTransform } = await import("./transform-Z4LA7G44.js");
1719
+ const { runTransform } = await import("./transform-L7OKE35T.js");
1715
1720
  const padding = {};
1716
1721
  if (typeof flags["pad-start"] === "string") {
1717
1722
  padding.padStartMs = parseDuration(flags["pad-start"]);
@@ -1739,19 +1744,19 @@ async function main() {
1739
1744
  console.log("");
1740
1745
  console.log(chainResult.previewTable);
1741
1746
  }
1742
- const { runTransform } = await import("./transform-Z4LA7G44.js");
1747
+ const { runTransform } = await import("./transform-L7OKE35T.js");
1743
1748
  await runTransform({ projectDir, progress });
1744
- const { runPreview: runPreview2 } = await import("./preview-UUWVOX5Y.js");
1749
+ const { runPreview: runPreview2 } = await import("./preview-7AGBBMPI.js");
1745
1750
  await runPreview2({ projectDir, progress, port, noOpen: flags["no-open"] === true });
1746
1751
  break;
1747
1752
  }
1748
- const { runPreview } = await import("./preview-UUWVOX5Y.js");
1753
+ const { runPreview } = await import("./preview-7AGBBMPI.js");
1749
1754
  await runPreview({ projectDir, progress, port, noOpen: flags["no-open"] === true });
1750
1755
  break;
1751
1756
  }
1752
1757
  case "render": {
1753
1758
  const { projectDir, progress } = requireProject();
1754
- const { runRender } = await import("./render-T2UXDN25.js");
1759
+ const { runRender } = await import("./render-LBIBW45Z.js");
1755
1760
  await runRender({ projectDir, progress, draft: flags.draft === true });
1756
1761
  break;
1757
1762
  }
@@ -8,11 +8,10 @@ import {
8
8
  } from "./chunk-GLABTDMO.js";
9
9
 
10
10
  // src/cli/guided/steps/preview.ts
11
- import { execSync } from "child_process";
12
11
  import { copyFileSync, existsSync, mkdirSync, readdirSync } from "fs";
13
12
  import { resolve } from "path";
14
13
  function copyPreviewAssets(options) {
15
- const { outputDir, audioDir, viewerDir } = options;
14
+ const { outputDir, dataDir, audioDir, viewerDir } = options;
16
15
  const viewerDataDir = resolve(viewerDir, "public", "data");
17
16
  const viewerAudioDir = resolve(viewerDir, "public", "audio");
18
17
  const result = {
@@ -26,10 +25,12 @@ function copyPreviewAssets(options) {
26
25
  copyFileSync(vizDataPath, resolve(viewerDataDir, "viz-data.json"));
27
26
  result.copiedVizData = true;
28
27
  }
29
- const timingPath = resolve(outputDir, "timing.json");
30
- if (existsSync(timingPath)) {
28
+ const timingOutputPath = resolve(outputDir, "timing.json");
29
+ const timingDataPath = resolve(dataDir, "timing.json");
30
+ const timingSource = existsSync(timingOutputPath) ? timingOutputPath : existsSync(timingDataPath) ? timingDataPath : null;
31
+ if (timingSource) {
31
32
  mkdirSync(viewerDataDir, { recursive: true });
32
- copyFileSync(timingPath, resolve(viewerDataDir, "timing.json"));
33
+ copyFileSync(timingSource, resolve(viewerDataDir, "timing.json"));
33
34
  result.copiedTiming = true;
34
35
  }
35
36
  if (existsSync(audioDir)) {
@@ -74,7 +75,8 @@ async function runPreview(options) {
74
75
  }
75
76
  }
76
77
  const audioDir = resolve(projectDir, "audio");
77
- const copyResult = copyPreviewAssets({ outputDir: outDir, audioDir, viewerDir });
78
+ const dataDir = resolve(projectDir, progress.project.dataDir);
79
+ const copyResult = copyPreviewAssets({ outputDir: outDir, dataDir, audioDir, viewerDir });
78
80
  if (copyResult.copiedVizData) {
79
81
  console.log(" \u2713 Copied viz-data.json to viewer/public/data/");
80
82
  }
@@ -84,26 +86,13 @@ async function runPreview(options) {
84
86
  if (copyResult.audioFileCount > 0) {
85
87
  console.log(` \u2713 Copied ${copyResult.audioFileCount} audio file(s) to viewer/public/audio/`);
86
88
  }
87
- const nodeModules = resolve(viewerDir, "node_modules");
88
- if (!existsSync(nodeModules)) {
89
- console.log(" Installing viewer dependencies...");
90
- execSync("pnpm install", { cwd: viewerDir, stdio: "inherit" });
91
- console.log(" \u2713 Dependencies installed");
92
- }
93
- const port = options.port || 5174;
94
89
  markComplete(progress, "preview");
95
90
  writeProgress(projectDir, progress);
96
- console.log(`
97
- Starting preview server on port ${port}...`);
98
- console.log(` Viewer: http://localhost:${port}`);
99
- console.log("\n Press Ctrl+C to stop.\n");
100
- try {
101
- execSync(`npx vite --port ${port}${options.noOpen ? "" : " --open"}`, {
102
- cwd: viewerDir,
103
- stdio: "inherit"
104
- });
105
- } catch {
106
- }
91
+ console.log("\n To start the preview server:");
92
+ console.log(
93
+ " cd viewer && pnpm install && nohup npx vite --host 0.0.0.0 --port 5174 > /tmp/vite.log 2>&1 &"
94
+ );
95
+ console.log("\n Then get a tunnel URL to share with the human.");
107
96
  }
108
97
  export {
109
98
  copyPreviewAssets,
@@ -2,7 +2,7 @@ import {
2
2
  canSync,
3
3
  getBoardSyncConfig,
4
4
  syncStepOutputs
5
- } from "./chunk-UTFBENVA.js";
5
+ } from "./chunk-7BH6QQNB.js";
6
6
  import {
7
7
  markComplete,
8
8
  markError,
@@ -11,7 +11,7 @@ import {
11
11
  canSync,
12
12
  getBoardSyncConfig,
13
13
  syncStepOutputs
14
- } from "./chunk-UTFBENVA.js";
14
+ } from "./chunk-7BH6QQNB.js";
15
15
  import {
16
16
  transformToRawData
17
17
  } from "./chunk-WP7ZSXBZ.js";
@@ -766,7 +766,7 @@ Output written to ${progress.project.outputDir}/:`);
766
766
  if (canSync()) {
767
767
  const syncConfig = getBoardSyncConfig(progress.project.dataDir);
768
768
  if (syncConfig) {
769
- await syncStepOutputs(syncConfig, "transform", outDir);
769
+ await syncStepOutputs(syncConfig, "transform", dataDir, outDir);
770
770
  }
771
771
  }
772
772
  console.log("\n\u2713 Transform complete. Proceed to the preview step.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miriad-viz",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snorrees/miriad-viz.git"