reviw 0.10.2 → 0.10.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.
Files changed (3) hide show
  1. package/README.md +11 -6
  2. package/cli.cjs +69 -28
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@ A lightweight browser-based tool for reviewing and annotating tabular data, text
6
6
 
7
7
  ### File Format Support
8
8
  - **CSV/TSV**: View tabular data with sticky headers, column freezing, filtering, and column resizing
9
- - **Markdown**: Side-by-side preview with synchronized scrolling
9
+ - **Markdown**: Side-by-side preview with synchronized scrolling, click-to-comment from preview
10
10
  - **Diff/Patch**: GitHub-style diff view with syntax highlighting, collapsible large files (500+ lines), and binary files sorted to end
11
11
  - **Text**: Line-by-line commenting for plain text files
12
12
 
@@ -15,9 +15,12 @@ A lightweight browser-based tool for reviewing and annotating tabular data, text
15
15
  - Click any diagram to open fullscreen viewer
16
16
  - Zoom with mouse wheel (centered on cursor position, up to 10x)
17
17
  - Pan with mouse drag
18
- - Minimap showing current viewport position
19
18
  - Syntax error display in toast notifications
20
19
 
20
+ ### Media Fullscreen
21
+ - Click images in Markdown preview to open fullscreen viewer
22
+ - Click videos to open fullscreen playback with native controls
23
+
21
24
  ### UI Features
22
25
  - **Theme toggle**: Switch between light and dark modes
23
26
  - **Multi-file support**: Open multiple files simultaneously on separate ports
@@ -62,6 +65,8 @@ reviw changes.diff
62
65
  - `--port <number>`: Specify starting port (default: 4989)
63
66
  - `--encoding <encoding>`: Force specific encoding (auto-detected by default)
64
67
  - `--no-open`: Prevent automatic browser opening
68
+ - `--help, -h`: Show help message
69
+ - `--version, -v`: Show version number
65
70
 
66
71
  ### Workflow
67
72
  1. Browser opens automatically (macOS: `open` / Linux: `xdg-open` / Windows: `start`)
@@ -72,16 +77,16 @@ reviw changes.diff
72
77
  ## Screenshots
73
78
 
74
79
  ### CSV View
75
- ![CSV View](./assets/screenshot-csv.png?v=2)
80
+ ![CSV View](https://raw.githubusercontent.com/kazuph/reviw/main/assets/screenshot-csv.png)
76
81
 
77
82
  ### Markdown View
78
- ![Markdown View](./assets/screenshot-md.png?v=2)
83
+ ![Markdown View](https://raw.githubusercontent.com/kazuph/reviw/main/assets/screenshot-md.png)
79
84
 
80
85
  ### Diff View
81
- ![Diff View](./assets/screenshot-diff.png?v=2)
86
+ ![Diff View](https://raw.githubusercontent.com/kazuph/reviw/main/assets/screenshot-diff.png)
82
87
 
83
88
  ### Mermaid Fullscreen
84
- ![Mermaid Fullscreen](./assets/screenshot-mermaid.png?v=2)
89
+ ![Mermaid Fullscreen](https://raw.githubusercontent.com/kazuph/reviw/main/assets/screenshot-mermaid.png)
85
90
 
86
91
  ## Output Example
87
92
 
package/cli.cjs CHANGED
@@ -21,6 +21,7 @@ const marked = require("marked");
21
21
  const yaml = require("js-yaml");
22
22
 
23
23
  // --- CLI arguments ---------------------------------------------------------
24
+ const VERSION = "0.10.3";
24
25
  const args = process.argv.slice(2);
25
26
 
26
27
  const filePaths = [];
@@ -31,6 +32,49 @@ let stdinMode = false;
31
32
  let diffMode = false;
32
33
  let stdinContent = null;
33
34
 
35
+ function showHelp() {
36
+ console.log(`reviw v${VERSION} - Lightweight file reviewer with in-browser comments
37
+
38
+ Usage:
39
+ reviw <file...> [options] Review files (CSV, TSV, Markdown, Text)
40
+ reviw <file.diff> Review diff/patch file
41
+ git diff | reviw [options] Review diff from stdin
42
+ reviw Auto run git diff HEAD
43
+
44
+ Supported Formats:
45
+ CSV/TSV Tabular data with sticky headers, filtering, column resizing
46
+ Markdown Side-by-side preview with synchronized scrolling, Mermaid diagrams
47
+ Diff/Patch GitHub-style view with syntax highlighting
48
+ Text Line-by-line commenting
49
+
50
+ Options:
51
+ --port <number> Server port (default: 4989)
52
+ --encoding <enc>, -e Force encoding (utf8, shift_jis, euc-jp, etc.)
53
+ --no-open Don't open browser automatically
54
+ --help, -h Show this help message
55
+ --version, -v Show version number
56
+
57
+ Examples:
58
+ reviw data.csv # Review CSV file
59
+ reviw README.md # Review Markdown with preview
60
+ reviw file1.csv file2.md # Multiple files on consecutive ports
61
+ git diff | reviw # Review uncommitted changes
62
+ git diff HEAD~3 | reviw # Review last 3 commits
63
+ reviw changes.patch # Review patch file
64
+
65
+ Workflow:
66
+ 1. Browser opens automatically (use --no-open to disable)
67
+ 2. Click cells/lines to add comments, drag to select multiple
68
+ 3. Press Cmd/Ctrl+Enter or click "Submit & Exit"
69
+ 4. Comments are output as YAML to stdout
70
+
71
+ More info: https://github.com/kazuph/reviw`);
72
+ }
73
+
74
+ function showVersion() {
75
+ console.log(VERSION);
76
+ }
77
+
34
78
  for (let i = 0; i < args.length; i += 1) {
35
79
  const arg = args[i];
36
80
  if (arg === "--port" && args[i + 1]) {
@@ -42,22 +86,10 @@ for (let i = 0; i < args.length; i += 1) {
42
86
  } else if (arg === "--no-open") {
43
87
  noOpen = true;
44
88
  } else if (arg === "--help" || arg === "-h") {
45
- console.log(`Usage: reviw <file...> [options]
46
- git diff | reviw [options]
47
- reviw [options] (auto runs git diff HEAD)
48
-
49
- Options:
50
- --port <number> Server port (default: 4989)
51
- --encoding <enc> Force encoding (utf8, shift_jis, etc.)
52
- --no-open Don't open browser automatically
53
- --help, -h Show this help message
54
-
55
- Examples:
56
- reviw data.csv # View CSV file
57
- reviw README.md # View Markdown file
58
- git diff | reviw # Review diff from stdin
59
- git diff HEAD~3 | reviw # Review diff from last 3 commits
60
- reviw # Auto run git diff HEAD`);
89
+ showHelp();
90
+ process.exit(0);
91
+ } else if (arg === "--version" || arg === "-v") {
92
+ showVersion();
61
93
  process.exit(0);
62
94
  } else if (!arg.startsWith("-")) {
63
95
  filePaths.push(arg);
@@ -4156,7 +4188,7 @@ function shutdownAll() {
4156
4188
  process.on("SIGINT", shutdownAll);
4157
4189
  process.on("SIGTERM", shutdownAll);
4158
4190
 
4159
- function createFileServer(filePath) {
4191
+ function createFileServer(filePath, fileIndex = 0) {
4160
4192
  return new Promise((resolve) => {
4161
4193
  const baseName = path.basename(filePath);
4162
4194
  const baseDir = path.dirname(filePath);
@@ -4371,14 +4403,18 @@ function createFileServer(filePath) {
4371
4403
  : process.platform === "win32"
4372
4404
  ? "start"
4373
4405
  : "xdg-open";
4374
- try {
4375
- spawn(opener, [url], { stdio: "ignore", detached: true });
4376
- } catch (err) {
4377
- console.warn(
4378
- "Failed to open browser automatically. Please open this URL manually:",
4379
- url,
4380
- );
4381
- }
4406
+ // Add delay for multiple files to avoid browser ignoring rapid open commands
4407
+ const delay = fileIndex * 300;
4408
+ setTimeout(() => {
4409
+ try {
4410
+ spawn(opener, [url], { stdio: "ignore", detached: true });
4411
+ } catch (err) {
4412
+ console.warn(
4413
+ "Failed to open browser automatically. Please open this URL manually:",
4414
+ url,
4415
+ );
4416
+ }
4417
+ }, delay);
4382
4418
  }
4383
4419
  startWatcher();
4384
4420
  resolve(ctx);
@@ -4587,12 +4623,13 @@ function createDiffServer(diffContent) {
4587
4623
  // File mode: files specified
4588
4624
  console.log(`Starting servers for ${resolvedPaths.length} file(s)...`);
4589
4625
  serversRunning = resolvedPaths.length;
4590
- for (const filePath of resolvedPaths) {
4591
- await createFileServer(filePath);
4626
+ for (let i = 0; i < resolvedPaths.length; i++) {
4627
+ await createFileServer(resolvedPaths[i], i);
4592
4628
  }
4593
4629
  console.log("Close all browser tabs or Submit & Exit to finish.");
4594
4630
  } else {
4595
4631
  // No files and no stdin: try auto git diff
4632
+ console.log(`reviw v${VERSION}`);
4596
4633
  console.log("No files specified. Running git diff HEAD...");
4597
4634
  try {
4598
4635
  const gitDiff = await runGitDiff();
@@ -4601,7 +4638,9 @@ function createDiffServer(diffContent) {
4601
4638
  console.log("");
4602
4639
  console.log("Usage: reviw <file...> [options]");
4603
4640
  console.log(" git diff | reviw [options]");
4604
- console.log(" reviw (auto runs git diff HEAD)");
4641
+ console.log(" reviw (auto runs git diff HEAD)");
4642
+ console.log("");
4643
+ console.log("Run 'reviw --help' for more information.");
4605
4644
  process.exit(0);
4606
4645
  }
4607
4646
  diffMode = true;
@@ -4615,6 +4654,8 @@ function createDiffServer(diffContent) {
4615
4654
  console.log("");
4616
4655
  console.log("Usage: reviw <file...> [options]");
4617
4656
  console.log(" git diff | reviw [options]");
4657
+ console.log("");
4658
+ console.log("Run 'reviw --help' for more information.");
4618
4659
  process.exit(1);
4619
4660
  }
4620
4661
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reviw",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "Lightweight file reviewer with in-browser comments for CSV, TSV, Markdown, and Git diffs.",
5
5
  "type": "module",
6
6
  "bin": {