miriad-viz 0.4.2 → 0.4.4

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.
@@ -90,7 +90,7 @@ var STEP_CONFIG = {
90
90
  mode: "inline",
91
91
  label: "Set visualization timing",
92
92
  creative: true,
93
- outputFiles: ["output/timing.json"]
93
+ outputFiles: ["data/timing.json"]
94
94
  },
95
95
  "sound-design": {
96
96
  mode: "inline",
@@ -189,6 +189,7 @@ function findProjectDir(startDir) {
189
189
  }
190
190
 
191
191
  export {
192
+ STEPS,
192
193
  createProgressFile,
193
194
  getNextStep,
194
195
  STEP_CONFIG,
@@ -9,7 +9,7 @@ import {
9
9
  markComplete,
10
10
  markInProgress,
11
11
  writeProgress
12
- } from "./chunk-X2MHAVAE.js";
12
+ } from "./chunk-IMD2MNLI.js";
13
13
 
14
14
  // src/cli/guided/steps/curate.ts
15
15
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -11,7 +11,7 @@ import {
11
11
  markError,
12
12
  markInProgress,
13
13
  writeProgress
14
- } from "./chunk-X2MHAVAE.js";
14
+ } from "./chunk-IMD2MNLI.js";
15
15
 
16
16
  // src/cli/guided/steps/extract.ts
17
17
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
package/dist-cli/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  PROGRESS_FILENAME,
3
+ STEPS,
3
4
  STEP_CONFIG,
4
5
  createProgressFile,
5
6
  findProjectDir,
6
7
  getNextStep,
7
8
  readProgress,
8
9
  writeProgress
9
- } from "./chunk-X2MHAVAE.js";
10
+ } from "./chunk-IMD2MNLI.js";
10
11
 
11
12
  // src/cli/guided/index.ts
12
13
  import { existsSync as existsSync3, readFileSync as readFileSync2, readdirSync } from "fs";
@@ -504,7 +505,9 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
504
505
  output.push(" search around turning points, find the best quotes");
505
506
  output.push(" 3. Write script.json with ordered narration lines");
506
507
  output.push(" 4. ALSO propose: phases, milestones, featured quotes (curation)");
507
- output.push(" 5. Present to human and iterate");
508
+ output.push(" 5. Curate chat pills: pick 10-20 standout messages, suggest placement");
509
+ output.push(" aligned with narration beats (think in %, not timestamps)");
510
+ output.push(" 6. Present to human and iterate");
508
511
  output.push("");
509
512
  output.push(" Script format:");
510
513
  output.push(' { "version": 1, "lines": [');
@@ -517,7 +520,7 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
517
520
  output.push(" Save as: data/script.json");
518
521
  output.push("");
519
522
  output.push(" When human approves: npx miriad-viz next --script-approved");
520
- const scriptDoc = readBundledDoc("script-writing");
523
+ const scriptDoc = readBundledDoc("miriad-viz-script-writing");
521
524
  if (scriptDoc) {
522
525
  output.push("");
523
526
  output.push("\u2501\u2501\u2501 SCRIPT WRITING GUIDE \u2501\u2501\u2501");
@@ -647,7 +650,7 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
647
650
  output.push("");
648
651
  output.push(" To skip voices and render a silent video:");
649
652
  output.push(" npx miriad-viz next --skip-audio");
650
- const voicesDoc = readBundledDoc("voice-generation");
653
+ const voicesDoc = readBundledDoc("miriad-viz-voice-generation");
651
654
  if (voicesDoc) {
652
655
  output.push("");
653
656
  output.push("\u2501\u2501\u2501 VOICE GENERATION GUIDE \u2501\u2501\u2501");
@@ -659,14 +662,14 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
659
662
  }
660
663
  if (step === "viz-timing") {
661
664
  if (flags["timing-approved"]) {
662
- if (!fileSet.has("output/timing.json")) {
665
+ if (!fileSet.has("data/timing.json")) {
663
666
  output.push(...buildVizTimingApprovalError());
664
667
  return { action: "error_shown", step, progress, output };
665
668
  }
666
669
  progress.steps["viz-timing"] = {
667
670
  status: "complete",
668
671
  completedAt: (/* @__PURE__ */ new Date()).toISOString(),
669
- outputs: ["output/timing.json"]
672
+ outputs: ["data/timing.json"]
670
673
  };
671
674
  output.push("", "\u2713 Timing approved.");
672
675
  const chainResult = computeNext(progress, existingFiles, logTails, flags, dataSummary, env);
@@ -911,6 +914,35 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
911
914
  return { action: "printed_command", step, command, progress, output };
912
915
  }
913
916
 
917
+ // src/cli/guided/show.ts
918
+ var VALID_SHOW_STEPS = STEPS.filter((s) => s !== "init");
919
+ function buildShowProgress(progress, stepName) {
920
+ if (!VALID_SHOW_STEPS.includes(stepName)) {
921
+ return {
922
+ error: `Unknown step: '${stepName}'. Valid steps: ${VALID_SHOW_STEPS.join(", ")}`
923
+ };
924
+ }
925
+ const targetStep = stepName;
926
+ const now = (/* @__PURE__ */ new Date()).toISOString();
927
+ const synthetic = {
928
+ ...progress,
929
+ steps: { ...progress.steps },
930
+ lastUpdated: now
931
+ };
932
+ let reachedTarget = false;
933
+ for (const step of STEPS) {
934
+ if (step === targetStep) {
935
+ synthetic.steps[step] = { status: "pending" };
936
+ reachedTarget = true;
937
+ } else if (!reachedTarget) {
938
+ synthetic.steps[step] = { status: "complete", completedAt: now };
939
+ } else {
940
+ synthetic.steps[step] = { status: "pending" };
941
+ }
942
+ }
943
+ return { progress: synthetic };
944
+ }
945
+
914
946
  // src/cli/guided/steps/init.ts
915
947
  import { existsSync as existsSync2, mkdirSync } from "fs";
916
948
  import { resolve as resolve2 } from "path";
@@ -1043,6 +1075,7 @@ Usage: npx miriad-viz <command> [options]
1043
1075
  Commands:
1044
1076
  init Initialize a new project
1045
1077
  next Advance to the next step
1078
+ show <step> Replay guidance for any step
1046
1079
  status Show current progress
1047
1080
  extract Run data extraction
1048
1081
  curate Generate curation scaffolds
@@ -1166,7 +1199,15 @@ async function runNext(flags) {
1166
1199
  port: typeof flags.port === "string" ? Number.parseInt(flags.port, 10) : void 0,
1167
1200
  "no-open": flags["no-open"] === true || void 0,
1168
1201
  "skip-audio": flags["skip-audio"] === true || void 0,
1169
- "audio-approved": flags["audio-approved"] === true || void 0
1202
+ "audio-approved": flags["audio-approved"] === true || void 0,
1203
+ // v2 gate flags
1204
+ "script-approved": flags["script-approved"] === true || void 0,
1205
+ "voices-approved": flags["voices-approved"] === true || void 0,
1206
+ "timing-approved": flags["timing-approved"] === true || void 0,
1207
+ "sound-approved": flags["sound-approved"] === true || void 0,
1208
+ // padding flags
1209
+ "pad-start": typeof flags["pad-start"] === "string" ? flags["pad-start"] : void 0,
1210
+ "pad-end": typeof flags["pad-end"] === "string" ? flags["pad-end"] : void 0
1170
1211
  };
1171
1212
  const env = {
1172
1213
  hasElevenLabsKey: !!process.env.ELEVENLABS_API_KEY
@@ -1214,7 +1255,7 @@ async function main() {
1214
1255
  }
1215
1256
  case "extract": {
1216
1257
  const { projectDir, progress } = requireProject();
1217
- const { runExtract } = await import("./extract-7SPUMODE.js");
1258
+ const { runExtract } = await import("./extract-OVHPN5EK.js");
1218
1259
  await runExtract({
1219
1260
  projectDir,
1220
1261
  progress,
@@ -1228,14 +1269,14 @@ async function main() {
1228
1269
  }
1229
1270
  case "curate": {
1230
1271
  const { projectDir, progress } = requireProject();
1231
- const { runCurate } = await import("./curate-7VM5QLE2.js");
1272
+ const { runCurate } = await import("./curate-36Q25TSU.js");
1232
1273
  await runCurate({ projectDir, progress });
1233
1274
  break;
1234
1275
  }
1235
1276
  case "transform": {
1236
1277
  const { projectDir, progress } = requireProject();
1237
1278
  const { parseDuration } = await import("./parse-duration-NVLCEFAF.js");
1238
- const { runTransform } = await import("./transform-BO6MECNO.js");
1279
+ const { runTransform } = await import("./transform-EE7CTQMM.js");
1239
1280
  const padding = {};
1240
1281
  if (typeof flags["pad-start"] === "string") {
1241
1282
  padding.padStartMs = parseDuration(flags["pad-start"]);
@@ -1263,19 +1304,19 @@ async function main() {
1263
1304
  console.log("");
1264
1305
  console.log(chainResult.previewTable);
1265
1306
  }
1266
- const { runTransform } = await import("./transform-BO6MECNO.js");
1307
+ const { runTransform } = await import("./transform-EE7CTQMM.js");
1267
1308
  await runTransform({ projectDir, progress });
1268
- const { runPreview: runPreview2 } = await import("./preview-QFLKQHQA.js");
1309
+ const { runPreview: runPreview2 } = await import("./preview-PXC6HTMF.js");
1269
1310
  await runPreview2({ projectDir, progress, port, noOpen: flags["no-open"] === true });
1270
1311
  break;
1271
1312
  }
1272
- const { runPreview } = await import("./preview-QFLKQHQA.js");
1313
+ const { runPreview } = await import("./preview-PXC6HTMF.js");
1273
1314
  await runPreview({ projectDir, progress, port, noOpen: flags["no-open"] === true });
1274
1315
  break;
1275
1316
  }
1276
1317
  case "render": {
1277
1318
  const { projectDir, progress } = requireProject();
1278
- const { runRender } = await import("./render-F5W4QY3Q.js");
1319
+ const { runRender } = await import("./render-EUUDJ5S7.js");
1279
1320
  await runRender({ projectDir, progress, draft: flags.draft === true });
1280
1321
  break;
1281
1322
  }
@@ -1375,6 +1416,42 @@ async function main() {
1375
1416
  }
1376
1417
  break;
1377
1418
  }
1419
+ case "show": {
1420
+ const stepName = positional[0];
1421
+ if (!stepName) {
1422
+ console.error(
1423
+ `
1424
+ \u2717 Missing step name. Usage: npx miriad-viz show <step>
1425
+ Valid steps: ${VALID_SHOW_STEPS.join(", ")}`
1426
+ );
1427
+ process.exit(1);
1428
+ }
1429
+ const { projectDir, progress } = requireProject();
1430
+ const showResult = buildShowProgress(progress, stepName);
1431
+ if (showResult.error) {
1432
+ console.error(`
1433
+ \u2717 ${showResult.error}`);
1434
+ process.exit(1);
1435
+ }
1436
+ const showFiles = [...gatherExistingFiles(projectDir), ...gatherAudioFiles(projectDir)];
1437
+ const showLogTails = gatherLogTails(projectDir);
1438
+ const showDataSummary = gatherDataSummary(projectDir, progress.project.dataDir);
1439
+ const showEnv = {
1440
+ hasElevenLabsKey: !!process.env.ELEVENLABS_API_KEY
1441
+ };
1442
+ const result = computeNext(
1443
+ showResult.progress,
1444
+ showFiles,
1445
+ showLogTails,
1446
+ {},
1447
+ showDataSummary,
1448
+ showEnv
1449
+ );
1450
+ for (const line of result.output) {
1451
+ console.log(line);
1452
+ }
1453
+ break;
1454
+ }
1378
1455
  case "help":
1379
1456
  case "--help":
1380
1457
  case "-h":
@@ -5,12 +5,50 @@ import {
5
5
  import {
6
6
  markComplete,
7
7
  writeProgress
8
- } from "./chunk-X2MHAVAE.js";
8
+ } from "./chunk-IMD2MNLI.js";
9
9
 
10
10
  // src/cli/guided/steps/preview.ts
11
11
  import { execSync } from "child_process";
12
- import { copyFileSync, existsSync, mkdirSync } from "fs";
12
+ import { copyFileSync, existsSync, mkdirSync, readdirSync } from "fs";
13
13
  import { resolve } from "path";
14
+ function copyPreviewAssets(options) {
15
+ const { outputDir, audioDir, viewerDir } = options;
16
+ const viewerDataDir = resolve(viewerDir, "public", "data");
17
+ const viewerAudioDir = resolve(viewerDir, "public", "audio");
18
+ const result = {
19
+ copiedVizData: false,
20
+ copiedTiming: false,
21
+ audioFileCount: 0
22
+ };
23
+ const vizDataPath = resolve(outputDir, "viz-data.json");
24
+ if (existsSync(vizDataPath)) {
25
+ mkdirSync(viewerDataDir, { recursive: true });
26
+ copyFileSync(vizDataPath, resolve(viewerDataDir, "viz-data.json"));
27
+ result.copiedVizData = true;
28
+ }
29
+ const timingPath = resolve(outputDir, "timing.json");
30
+ if (existsSync(timingPath)) {
31
+ mkdirSync(viewerDataDir, { recursive: true });
32
+ copyFileSync(timingPath, resolve(viewerDataDir, "timing.json"));
33
+ result.copiedTiming = true;
34
+ }
35
+ if (existsSync(audioDir)) {
36
+ const audioFiles = readdirSync(audioDir).filter((f) => /\.(mp3|wav|ogg|m4a)$/i.test(f));
37
+ if (audioFiles.length > 0) {
38
+ mkdirSync(viewerAudioDir, { recursive: true });
39
+ for (const f of audioFiles) {
40
+ copyFileSync(resolve(audioDir, f), resolve(viewerAudioDir, f));
41
+ }
42
+ result.audioFileCount = audioFiles.length;
43
+ }
44
+ const manifestPath = resolve(audioDir, "audio-manifest.json");
45
+ if (existsSync(manifestPath)) {
46
+ mkdirSync(viewerAudioDir, { recursive: true });
47
+ copyFileSync(manifestPath, resolve(viewerAudioDir, "audio-manifest.json"));
48
+ }
49
+ }
50
+ return result;
51
+ }
14
52
  async function runPreview(options) {
15
53
  const { projectDir, progress } = options;
16
54
  const outDir = resolve(projectDir, progress.project.outputDir);
@@ -35,10 +73,17 @@ async function runPreview(options) {
35
73
  return;
36
74
  }
37
75
  }
38
- const viewerDataDir = resolve(viewerDir, "public", "data");
39
- mkdirSync(viewerDataDir, { recursive: true });
40
- copyFileSync(vizDataPath, resolve(viewerDataDir, "viz-data.json"));
41
- console.log(" \u2713 Copied viz-data.json to viewer/public/data/");
76
+ const audioDir = resolve(projectDir, "audio");
77
+ const copyResult = copyPreviewAssets({ outputDir: outDir, audioDir, viewerDir });
78
+ if (copyResult.copiedVizData) {
79
+ console.log(" \u2713 Copied viz-data.json to viewer/public/data/");
80
+ }
81
+ if (copyResult.copiedTiming) {
82
+ console.log(" \u2713 Copied timing.json to viewer/public/data/");
83
+ }
84
+ if (copyResult.audioFileCount > 0) {
85
+ console.log(` \u2713 Copied ${copyResult.audioFileCount} audio file(s) to viewer/public/audio/`);
86
+ }
42
87
  const nodeModules = resolve(viewerDir, "node_modules");
43
88
  if (!existsSync(nodeModules)) {
44
89
  console.log(" Installing viewer dependencies...");
@@ -61,5 +106,6 @@ async function runPreview(options) {
61
106
  }
62
107
  }
63
108
  export {
109
+ copyPreviewAssets,
64
110
  runPreview
65
111
  };
@@ -3,7 +3,7 @@ import {
3
3
  markError,
4
4
  markInProgress,
5
5
  writeProgress
6
- } from "./chunk-X2MHAVAE.js";
6
+ } from "./chunk-IMD2MNLI.js";
7
7
 
8
8
  // src/cli/guided/steps/render.ts
9
9
  import { execSync } from "child_process";
@@ -9,7 +9,7 @@ import {
9
9
  markError,
10
10
  markInProgress,
11
11
  writeProgress
12
- } from "./chunk-X2MHAVAE.js";
12
+ } from "./chunk-IMD2MNLI.js";
13
13
  import {
14
14
  TimingFileSchema
15
15
  } from "./chunk-SKRQW7PY.js";