git-trace 0.1.0

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 (48) hide show
  1. package/.tracerc.example +38 -0
  2. package/README.md +136 -0
  3. package/bun.lock +511 -0
  4. package/bunchee.config.ts +11 -0
  5. package/cli/index.ts +251 -0
  6. package/cli/parser.ts +76 -0
  7. package/cli/tsconfig.json +6 -0
  8. package/dist/cli/index.d.ts +1 -0
  9. package/dist/cli/index.js +858 -0
  10. package/dist/config.cjs +66 -0
  11. package/dist/config.d.ts +15 -0
  12. package/dist/config.js +63 -0
  13. package/dist/highlight/index.cjs +770 -0
  14. package/dist/highlight/index.d.ts +26 -0
  15. package/dist/highlight/index.js +766 -0
  16. package/dist/index.cjs +849 -0
  17. package/dist/index.d.ts +52 -0
  18. package/dist/index.js +845 -0
  19. package/examples/demo/App.tsx +78 -0
  20. package/examples/demo/index.html +12 -0
  21. package/examples/demo/main.tsx +10 -0
  22. package/examples/demo/mockData.ts +170 -0
  23. package/examples/demo/styles.css +103 -0
  24. package/examples/demo/tsconfig.json +21 -0
  25. package/examples/demo/tsconfig.node.json +10 -0
  26. package/examples/demo/vite.config.ts +20 -0
  27. package/package.json +58 -0
  28. package/src/Trace.tsx +717 -0
  29. package/src/cache.ts +118 -0
  30. package/src/config.ts +51 -0
  31. package/src/entries/config.ts +7 -0
  32. package/src/entries/gitea.ts +4 -0
  33. package/src/entries/github.ts +5 -0
  34. package/src/entries/gitlab.ts +4 -0
  35. package/src/gitea.ts +58 -0
  36. package/src/github.ts +100 -0
  37. package/src/gitlab.ts +65 -0
  38. package/src/highlight/highlight.ts +119 -0
  39. package/src/highlight/index.ts +4 -0
  40. package/src/host.ts +32 -0
  41. package/src/index.ts +6 -0
  42. package/src/patterns.ts +6 -0
  43. package/src/shared.ts +108 -0
  44. package/src/themes.ts +98 -0
  45. package/src/types.ts +72 -0
  46. package/test/e2e.html +424 -0
  47. package/tsconfig.json +18 -0
  48. package/vercel.json +4 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "./.tracerc.schema.json",
3
+ "aiPatterns": {
4
+ "emails": [
5
+ "noreply@cursor.sh",
6
+ "claude@anthropic.com",
7
+ "bot@github.com",
8
+ "copilot",
9
+ "cursor"
10
+ ],
11
+ "messages": [
12
+ "Co-Authored-By: Claude",
13
+ "Co-Authored-By: Cursor",
14
+ "Generated-by:",
15
+ "[skip-human-review]",
16
+ "AI-generated"
17
+ ],
18
+ "logins": [
19
+ "bot",
20
+ "cli-bot",
21
+ "dependabot",
22
+ "renovate"
23
+ ]
24
+ },
25
+ "defaults": {
26
+ "last": 10,
27
+ "autoPlay": false,
28
+ "interval": 2000
29
+ },
30
+ "cache": {
31
+ "enabled": true,
32
+ "ttl": 86400000
33
+ },
34
+ "output": {
35
+ "format": "html",
36
+ "theme": "dark"
37
+ }
38
+ }
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # git-trace
2
+ <img width="1828" height="1350" alt="image" src="https://github.com/user-attachments/assets/12ff8e4e-6360-446a-9ad6-80b9efed700e" />
3
+
4
+
5
+ Git history visualizer for the AI coding era.
6
+
7
+ ## Quick Start
8
+
9
+ ```tsx
10
+ import { Trace } from 'git-trace'
11
+
12
+ <Trace commits={commits} autoPlay interval={2000} />
13
+ ```
14
+
15
+ ## Props
16
+
17
+ | Prop | Type | Default | Description |
18
+ |------|------|---------|-------------|
19
+ | `commits` | `Commit[]` | `[]` | Array of commits |
20
+ | `autoPlay` | `boolean` | `false` | Auto-play through commits |
21
+ | `interval` | `number` | `2000` | Ms between commits |
22
+ | `onCommit` | `(commit) => void` | — | Callback on commit change |
23
+ | `className` | `string` | — | CSS class for root element |
24
+ | `theme` | `Theme` | `'dark'` | Color theme |
25
+ | `filterable` | `boolean` | `false` | Enable filter/search UI |
26
+ | `defaultFilter` | `FilterOptions` | `{}` | Initial filter state |
27
+ | `onFilterChange` | `(filter) => void` | — | Callback when filter changes |
28
+
29
+ ## Commit Type
30
+
31
+ ```ts
32
+ type Commit = {
33
+ hash: string
34
+ message: string
35
+ author: string
36
+ authorType: 'human' | 'ai'
37
+ time: string
38
+ lines: DiffLine[]
39
+ }
40
+
41
+ type DiffLine = {
42
+ type: 'add' | 'remove' | 'ctx'
43
+ content: string
44
+ }
45
+ ```
46
+
47
+ ## Filtering
48
+
49
+ Enable the filter UI with `filterable={true}`:
50
+
51
+ ```tsx
52
+ import { Trace } from 'git-trace'
53
+
54
+ <Trace
55
+ commits={commits}
56
+ filterable={true}
57
+ onFilterChange={(filter) => console.log(filter)}
58
+ />
59
+ ```
60
+
61
+ **FilterOptions:**
62
+ ```ts
63
+ type FilterOptions = {
64
+ search?: string // Search in message, author, hash
65
+ authorType?: 'all' | 'human' | 'ai'
66
+ dateFrom?: string // ISO date string (future)
67
+ dateTo?: string // ISO date string (future)
68
+ }
69
+ ```
70
+
71
+ **Programmatic filtering:**
72
+ ```tsx
73
+ const [filter, setFilter] = useState({ authorType: 'ai' })
74
+
75
+ <Trace
76
+ commits={commits}
77
+ filterable={true}
78
+ defaultFilter={filter}
79
+ onFilterChange={setFilter}
80
+ />
81
+ ```
82
+
83
+ ## CLI
84
+
85
+ ```bash
86
+ # Local git history to JSON
87
+ npx git-trace src/App.tsx --last 8 --json > commits.json
88
+
89
+ # Standalone HTML
90
+ npx git-trace src/App.tsx --last 8 --output embed.html
91
+
92
+ # Fetch from GitHub (cached 24h)
93
+ npx git-trace owner/repo src/path.ts --token $GITHUB_TOKEN
94
+
95
+ # Cache management
96
+ npx git-trace cache # Show cache info
97
+ npx git-trace cache clear # Clear cache
98
+ ```
99
+
100
+ ## Configuration
101
+
102
+ Create `.tracerc` in project root or `~/.tracerc`:
103
+
104
+ ```json
105
+ {
106
+ "aiPatterns": {
107
+ "emails": ["noreply@cursor.sh", "claude@anthropic.com"],
108
+ "messages": ["Co-Authored-By: Claude", "AI-generated"],
109
+ "logins": ["bot", "dependabot"]
110
+ },
111
+ "defaults": {
112
+ "last": 10,
113
+ "autoPlay": false,
114
+ "interval": 2000
115
+ },
116
+ "cache": {
117
+ "enabled": true,
118
+ "ttl": 86400000
119
+ }
120
+ }
121
+ ```
122
+
123
+ ## Syntax Highlighting (Optional)
124
+
125
+ ```tsx
126
+ // Core: ~3.6KB gzipped
127
+ import { Trace } from 'git-trace'
128
+
129
+ // With syntax highlighting: +6KB
130
+ import { Trace } from 'git-trace'
131
+ import 'git-trace/highlight'
132
+ ```
133
+
134
+ ## License
135
+
136
+ MIT