kasaneru 0.0.2 → 0.0.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to `kasaneru` are documented in this file.
4
4
 
5
+ ## [0.0.3] - 2026-11-21
6
+
7
+ ### Fixed
8
+
9
+ - `--help` / `-h` and `--version` / `-v` work; an unknown option prints the usage instead of a stack trace.
10
+
5
11
  ## [0.0.2] - 2026-11-21
6
12
 
7
13
  ### Changed
package/README.ja.md CHANGED
@@ -46,6 +46,7 @@ node bin/kasaneru.mjs inspect out/basic.mp4
46
46
  | `captions <字幕ファイル> --fps N` | SRT・ASSを `[{from, to, text}]`(コマ数)のJSONにする |
47
47
  | `probe <素材> [--fps N]` | 素材の長さ(コマ数)・大きさ・音声の有無を調べる |
48
48
  | `envelope <音声> --fps N` | コマごとの音量を配列で出す(口パクなど) |
49
+ | `--help` / `--version` | 使い方・版を表示する。知らない指定を渡すと、どれが違うかと使い方を出して終了コード2で終わる |
49
50
 
50
51
  `render` の主な指定:
51
52
 
package/README.md CHANGED
@@ -46,6 +46,7 @@ node bin/kasaneru.mjs inspect out/basic.mp4
46
46
  | `captions <subtitle file> --fps N` | Converts SRT/ASS to JSON `[{from, to, text}]` (in frames) |
47
47
  | `probe <asset> [--fps N]` | Reports an asset's length (in frames), dimensions, and whether it has audio |
48
48
  | `envelope <audio> --fps N` | Outputs the per-frame volume as an array (for lip sync and the like) |
49
+ | `--help` / `--version` | Prints the usage or the version. An unknown option prints which one and the usage, and exits with code 2 |
49
50
 
50
51
  Main options for `render`:
51
52
 
package/bin/kasaneru.mjs CHANGED
@@ -14,6 +14,7 @@ import {readSubtitles, toFrames} from '../src/subtitles.mjs';
14
14
  import {formatProblems, validateManifest} from '../src/validate.mjs';
15
15
 
16
16
  const USAGE = `usage:
17
+ kasaneru --help | --version
17
18
  kasaneru render <manifest.json> -o <out.mp4|.mov|.webm|.gif> Render
18
19
  [--backend browser|flutter|none] [--frames A-B] [--concurrency N] [--props <file|json>] [--set a.b=value]...
19
20
  [--encoder libx264|h264_videotoolbox] [--crf N] [--audio-bitrate 192k] [--every-frame] [--keep-work] [--work <dir>]
@@ -28,31 +29,46 @@ const USAGE = `usage:
28
29
  kasaneru probe <file> [--fps N] Report the length and dimensions of an asset
29
30
  kasaneru envelope <audio> --fps N Output the per-frame volume as JSON (for lip sync)`;
30
31
 
31
- const {values: opt, positionals} = parseArgs({
32
- allowPositionals: true,
33
- options: {
34
- out: {type: 'string', short: 'o'},
35
- backend: {type: 'string', default: 'browser'},
36
- 'every-frame': {type: 'boolean', default: false},
37
- concurrency: {type: 'string', default: '4'},
38
- encoder: {type: 'string', default: 'libx264'},
39
- crf: {type: 'string', default: '18'},
40
- 'audio-bitrate': {type: 'string'},
41
- 'allow-missing-assets': {type: 'boolean', default: false},
42
- work: {type: 'string'},
43
- frames: {type: 'string'},
44
- frame: {type: 'string'},
45
- 'keep-work': {type: 'boolean', default: false},
46
- fps: {type: 'string'},
47
- props: {type: 'string'},
48
- set: {type: 'string', multiple: true},
49
- deep: {type: 'boolean', default: false},
50
- every: {type: 'string'},
51
- manifest: {type: 'string'},
52
- cols: {type: 'string', default: '4'},
53
- key: {type: 'string'},
54
- },
55
- });
32
+ let parsed;
33
+ try {
34
+ parsed = parseArgs({
35
+ allowPositionals: true,
36
+ options: {
37
+ help: {type: 'boolean', short: 'h', default: false},
38
+ version: {type: 'boolean', short: 'v', default: false},
39
+ out: {type: 'string', short: 'o'},
40
+ backend: {type: 'string', default: 'browser'},
41
+ 'every-frame': {type: 'boolean', default: false},
42
+ concurrency: {type: 'string', default: '4'},
43
+ encoder: {type: 'string', default: 'libx264'},
44
+ crf: {type: 'string', default: '18'},
45
+ 'audio-bitrate': {type: 'string'},
46
+ 'allow-missing-assets': {type: 'boolean', default: false},
47
+ work: {type: 'string'},
48
+ frames: {type: 'string'},
49
+ frame: {type: 'string'},
50
+ 'keep-work': {type: 'boolean', default: false},
51
+ fps: {type: 'string'},
52
+ props: {type: 'string'},
53
+ set: {type: 'string', multiple: true},
54
+ deep: {type: 'boolean', default: false},
55
+ every: {type: 'string'},
56
+ manifest: {type: 'string'},
57
+ cols: {type: 'string', default: '4'},
58
+ key: {type: 'string'},
59
+ },
60
+ });
61
+ } catch (e) {
62
+ // An unknown option or a missing value: say which, then show the usage (not a stack trace).
63
+ console.error(`${e.message}\n\n${USAGE}`);
64
+ process.exit(2);
65
+ }
66
+ const {values: opt, positionals} = parsed;
67
+ if (opt.help) { console.log(USAGE); process.exit(0); }
68
+ if (opt.version) {
69
+ console.log(JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version);
70
+ process.exit(0);
71
+ }
56
72
  const [command, target] = positionals;
57
73
  const fail = (message, code = 2) => { console.error(message); process.exit(code); };
58
74
  const print = (value) => console.log(JSON.stringify(value, null, 2));
@@ -1,7 +1,7 @@
1
1
  name: kasaneru_flutter
2
2
  description: Flutter rendering backend for kasaneru. Captures widgets as transparent PNGs inside flutter test.
3
3
  publish_to: none
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  environment:
6
6
  sdk: ^3.8.0
7
7
  dependencies:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kasaneru",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "description": "Render video from a JSON manifest. ffmpeg cuts and composites video and audio; a rendering backend (browser or Flutter) draws text, shapes and 3D as images to layer on top",
6
6
  "keywords": [