eprec 1.10.0 → 1.10.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.
@@ -1416,14 +1416,21 @@ function buildCommandPreview(
1416
1416
  ? sourcePath
1417
1417
  : sourceName
1418
1418
  return [
1419
- 'bun process-course/edits/cli.ts edit-video \\',
1420
- ` --input "${inputPath}" \\`,
1421
- ' --transcript "transcript.json" \\',
1422
- ' --edited "transcript.txt" \\',
1423
- ` --output "${outputName}"`,
1419
+ 'eprec edit \\',
1420
+ ` --input ${escapeShellArg(inputPath)} \\`,
1421
+ ` --transcript ${escapeShellArg('transcript.json')} \\`,
1422
+ ` --edited ${escapeShellArg('transcript.txt')} \\`,
1423
+ ` --output ${escapeShellArg(outputName)}`,
1424
1424
  ].join('\n')
1425
1425
  }
1426
1426
 
1427
+ function escapeShellArg(value: string) {
1428
+ if (value.length === 0) {
1429
+ return "''"
1430
+ }
1431
+ return `'${value.replace(/'/g, "'\"'\"'")}'`
1432
+ }
1433
+
1427
1434
  function findPreviousCut(cutRanges: CutRange[], playhead: number) {
1428
1435
  let previous: CutRange | null = null
1429
1436
  for (const range of cutRanges) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eprec",
3
3
  "type": "module",
4
- "version": "1.10.0",
4
+ "version": "1.10.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -70,21 +70,29 @@ function buildInstructions(options: {
70
70
  transcriptTextPath: string
71
71
  outputBasename: string
72
72
  }): string {
73
+ const outputPath = path.join(options.editsDirectory, options.outputBasename)
73
74
  return [
74
75
  '# Manual edit workflow',
75
76
  '',
76
77
  '1) Edit `transcript.txt` and delete whole words only.',
77
78
  '2) Run:',
78
79
  '',
79
- ` bun process-course/edits/cli.ts edit-video \\`,
80
- ` --input "${options.originalVideoPath}" \\`,
81
- ` --transcript "${options.transcriptJsonPath}" \\`,
82
- ` --edited "${options.transcriptTextPath}" \\`,
83
- ` --output "${path.join(options.editsDirectory, options.outputBasename)}"`,
80
+ ` eprec edit \\`,
81
+ ` --input ${escapeShellArg(options.originalVideoPath)} \\`,
82
+ ` --transcript ${escapeShellArg(options.transcriptJsonPath)} \\`,
83
+ ` --edited ${escapeShellArg(options.transcriptTextPath)} \\`,
84
+ ` --output ${escapeShellArg(outputPath)}`,
84
85
  '',
85
86
  'If the transcript no longer matches, regenerate it with:',
86
87
  '',
87
- ` bun process-course/edits/regenerate-transcript.ts --dir "${options.editsDirectory}"`,
88
+ ` bun process-course/edits/regenerate-transcript.ts --dir ${escapeShellArg(options.editsDirectory)}`,
88
89
  '',
89
90
  ].join('\n')
90
91
  }
92
+
93
+ function escapeShellArg(value: string) {
94
+ if (value.length === 0) {
95
+ return "''"
96
+ }
97
+ return `'${value.replace(/'/g, "'\"'\"'")}'`
98
+ }