miriad-viz 0.13.2 → 0.13.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.
@@ -52,6 +52,23 @@ function deriveTimingFromCuration(curation, script) {
52
52
  lines
53
53
  };
54
54
  }
55
+ var PILL_PROGRESS_TOLERANCE = 1;
56
+ function validateQuotePillSync(curation) {
57
+ const errors = [];
58
+ const { narration, pills } = curation;
59
+ for (const line of narration) {
60
+ if (line.type !== "quote") continue;
61
+ const hasMatchingPill = pills.some(
62
+ (pill) => pill.speaker === line.speaker && Math.abs(pill.progress - line.progress) <= PILL_PROGRESS_TOLERANCE
63
+ );
64
+ if (!hasMatchingPill) {
65
+ errors.push(
66
+ `${line.id} is a quote line at progress ${line.progress} but has no pill for speaker '${line.speaker}' \u2014 add a pill or keep the auto-generated anchor`
67
+ );
68
+ }
69
+ }
70
+ return errors;
71
+ }
55
72
  function runFromCurationChain(dataDir) {
56
73
  const curationPath = resolve(dataDir, "viz-curation.json");
57
74
  const scriptPath = resolve(dataDir, "script.json");
@@ -83,6 +100,14 @@ function runFromCurationChain(dataDir) {
83
100
  const message = err instanceof Error ? err.message : String(err);
84
101
  return { success: false, error: `Invalid script.json: ${message}` };
85
102
  }
103
+ const pillErrors = validateQuotePillSync(curation);
104
+ if (pillErrors.length > 0) {
105
+ return {
106
+ success: false,
107
+ error: `Quote-pill sync errors:
108
+ ${pillErrors.map((e) => ` \u2022 ${e}`).join("\n")}`
109
+ };
110
+ }
86
111
  let timing;
87
112
  try {
88
113
  timing = deriveTimingFromCuration(curation, script);
@@ -114,5 +139,6 @@ function runFromCurationChain(dataDir) {
114
139
  }
115
140
  export {
116
141
  deriveTimingFromCuration,
117
- runFromCurationChain
142
+ runFromCurationChain,
143
+ validateQuotePillSync
118
144
  };
package/dist-cli/index.js CHANGED
@@ -1964,7 +1964,7 @@ async function main() {
1964
1964
  const port = typeof flags.port === "string" ? Number.parseInt(flags.port, 10) : void 0;
1965
1965
  if (flags["from-curation"] === true) {
1966
1966
  const dataDir = resolve3(projectDir, progress.project.dataDir);
1967
- const { runFromCurationChain } = await import("./from-curation-chain-4DRH35PM.js");
1967
+ const { runFromCurationChain } = await import("./from-curation-chain-ISW6WNEM.js");
1968
1968
  console.log("\n\u{1F517} Running from-curation chain: curation \u2192 timing \u2192 transform \u2192 preview\n");
1969
1969
  const chainResult = runFromCurationChain(dataDir);
1970
1970
  if (!chainResult.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miriad-viz",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snorrees/miriad-viz.git"