difit 0.0.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.
Files changed (46) hide show
  1. package/README.md +106 -0
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.js +44 -0
  4. package/dist/cli/index.test.d.ts +1 -0
  5. package/dist/cli/index.test.js +676 -0
  6. package/dist/cli/utils.d.ts +1 -0
  7. package/dist/cli/utils.js +11 -0
  8. package/dist/cli/utils.test.d.ts +1 -0
  9. package/dist/cli/utils.test.js +214 -0
  10. package/dist/client/assets/index-BUtmfbD2.js +53 -0
  11. package/dist/client/assets/index-mZRIDsXW.css +1 -0
  12. package/dist/client/assets/prism-css-Bpx-unsJ.js +1 -0
  13. package/dist/client/assets/prism-json-xwnKirkR.js +1 -0
  14. package/dist/client/assets/prism-typescript-B2PMeEx1.js +1 -0
  15. package/dist/client/index.html +14 -0
  16. package/dist/server/comment-store.d.ts +13 -0
  17. package/dist/server/comment-store.js +63 -0
  18. package/dist/server/git-diff-tui.d.ts +2 -0
  19. package/dist/server/git-diff-tui.js +95 -0
  20. package/dist/server/git-diff.d.ts +10 -0
  21. package/dist/server/git-diff.js +124 -0
  22. package/dist/server/git-diff.test.d.ts +1 -0
  23. package/dist/server/git-diff.test.js +292 -0
  24. package/dist/server/server.d.ts +11 -0
  25. package/dist/server/server.js +128 -0
  26. package/dist/server/server.test.d.ts +1 -0
  27. package/dist/server/server.test.js +382 -0
  28. package/dist/tui/App.d.ts +8 -0
  29. package/dist/tui/App.js +92 -0
  30. package/dist/tui/App.test.d.ts +1 -0
  31. package/dist/tui/App.test.js +31 -0
  32. package/dist/tui/components/DiffViewer.d.ts +9 -0
  33. package/dist/tui/components/DiffViewer.js +88 -0
  34. package/dist/tui/components/FileList.d.ts +8 -0
  35. package/dist/tui/components/FileList.js +48 -0
  36. package/dist/tui/components/SideBySideDiffViewer.d.ts +9 -0
  37. package/dist/tui/components/SideBySideDiffViewer.js +237 -0
  38. package/dist/tui/components/StatusBar.d.ts +8 -0
  39. package/dist/tui/components/StatusBar.js +23 -0
  40. package/dist/tui/utils/parseDiff.d.ts +2 -0
  41. package/dist/tui/utils/parseDiff.js +68 -0
  42. package/dist/types/diff.d.ts +33 -0
  43. package/dist/types/diff.js +1 -0
  44. package/dist/utils/fileUtils.d.ts +12 -0
  45. package/dist/utils/fileUtils.js +21 -0
  46. package/package.json +91 -0
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # ReviewIt šŸ”
2
+
3
+ A lightweight command-line tool that spins up a local web server to display Git commit diffs in a GitHub-like Files changed view. Perfect for code review workflows without leaving the terminal! šŸš€
4
+
5
+ ## ✨ Features
6
+
7
+ - šŸŒ™ **GitHub-like UI**: Familiar dark theme file list and diff interface
8
+ - šŸ’¬ **Inline Comments**: Add comments to specific lines and generate Claude Code prompts
9
+ - šŸ”„ **Side-by-Side & Inline Views**: Choose your preferred diff viewing mode
10
+ - ⚔ **Zero Config**: Just run `npx reviewit <commit>` and it works
11
+ - šŸ” **Local Only**: Never exposes data over network - runs on localhost only
12
+ - šŸ› ļø **Modern Stack**: React 18 + TypeScript + Tailwind CSS
13
+
14
+ ## šŸ“¦ Installation
15
+
16
+ ```bash
17
+ # Global install
18
+ npm install -g reviewit
19
+
20
+ # Or use npx (no installation needed)
21
+ npx reviewit <commit-ish>
22
+ ```
23
+
24
+ ## šŸš€ Usage
25
+
26
+ ```bash
27
+ # Review a specific commit
28
+ reviewit 6f4a9b7
29
+
30
+ # Review HEAD~3
31
+ reviewit HEAD~3
32
+
33
+ # Custom port, don't auto-open browser
34
+ reviewit 6f4a9b7 --port 4300 --no-open
35
+
36
+ # Via npx
37
+ npx reviewit main~1
38
+ ```
39
+
40
+ ### āš™ļø CLI Options
41
+
42
+ | Flag | Default | Description |
43
+ |------|---------|-------------|
44
+ | `<commit-ish>` | (required) | Any Git reference: hash, tag, HEAD~n, branch |
45
+ | `--port` | auto | Preferred port; falls back if occupied |
46
+ | `--no-open` | false | Don't automatically open browser |
47
+ | `--mode` | side-by-side | Diff mode: `inline` or `side-by-side` |
48
+
49
+ ## šŸ› ļø Development
50
+
51
+ ```bash
52
+ # Install dependencies
53
+ pnpm install
54
+
55
+ # Start development server
56
+ pnpm run dev
57
+
58
+ # Build for production
59
+ pnpm run build
60
+
61
+ # Run tests
62
+ pnpm test
63
+
64
+ # Lint and format
65
+ pnpm run lint
66
+ pnpm run format
67
+ pnpm run typecheck
68
+ ```
69
+
70
+ ## šŸ’¬ Comment System
71
+
72
+ ReviewIt includes an inline commenting system that integrates with Claude Code:
73
+
74
+ 1.ļø **Add Comments**: Click the šŸ’¬ icon on any diff line to add a comment
75
+ 2. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for Claude Code
76
+ 3. **Persistent Storage**: Comments are saved in `.reviewit/tmp-comments-*.json` for the session
77
+
78
+ ### Comment Prompt Format
79
+
80
+ ```
81
+ šŸ“„ src/components/Button.tsx L42
82
+ ----
83
+ + const handleClick = () => {
84
+ + onClick();
85
+ + };
86
+ ----
87
+ Comment: "This function name could be more specific"
88
+ ```
89
+
90
+ ## šŸ—ļø Architecture
91
+
92
+ - **CLI**: Commander.js for argument parsing
93
+ - **Backend**: Express server with simple-git for diff processing
94
+ - **Frontend**: React 18 + TypeScript + Vite
95
+ - **Styling**: Tailwind CSS v4 with GitHub-like dark theme
96
+ - **Testing**: Vitest for unit tests
97
+ - **Quality**: ESLint, Prettier, lefthook pre-commit hooks
98
+
99
+ ## šŸ“‹ Requirements
100
+
101
+ - Node.js ≄ 18.0.0
102
+ - Git repository with commits to review
103
+
104
+ ## šŸ“„ License
105
+
106
+ MIT šŸ“
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { startServer } from '../server/server.js';
4
+ import { validateCommitish } from './utils.js';
5
+ const program = new Command();
6
+ program
7
+ .name('reviewit')
8
+ .description('A lightweight Git diff viewer with GitHub-like interface')
9
+ .version('0.1.0')
10
+ .argument('<commit-ish>', 'Git commit, tag, branch, or HEAD~n reference')
11
+ .option('--port <port>', 'preferred port (auto-assigned if occupied)', parseInt)
12
+ .option('--no-open', 'do not automatically open browser')
13
+ .option('--mode <mode>', 'diff mode (inline only for now)', 'inline')
14
+ .action(async (commitish, options) => {
15
+ try {
16
+ if (!validateCommitish(commitish)) {
17
+ console.error('Error: Invalid commit-ish format');
18
+ process.exit(1);
19
+ }
20
+ const { url } = await startServer({
21
+ commitish,
22
+ preferredPort: options.port,
23
+ openBrowser: options.open,
24
+ mode: options.mode,
25
+ });
26
+ console.log(`\nšŸš€ ReviewIt server started on ${url}`);
27
+ console.log(`šŸ“‹ Reviewing: ${commitish}`);
28
+ if (options.open) {
29
+ console.log('🌐 Opening browser...\n');
30
+ }
31
+ else {
32
+ console.log('šŸ’” Use --open to automatically open browser\n');
33
+ }
34
+ process.on('SIGINT', () => {
35
+ console.log('\nšŸ‘‹ Shutting down ReviewIt server...');
36
+ process.exit(0);
37
+ });
38
+ }
39
+ catch (error) {
40
+ console.error('Error:', error instanceof Error ? error.message : 'Unknown error');
41
+ process.exit(1);
42
+ }
43
+ });
44
+ program.parse();
@@ -0,0 +1 @@
1
+ export {};