git-pkgs 0.4.0 → 0.5.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.
data/docs/schema.md DELETED
@@ -1,129 +0,0 @@
1
- # Database Schema
2
-
3
- git-pkgs stores dependency history in a SQLite database at `.git/pkgs.sqlite3`.
4
-
5
- ## Tables
6
-
7
- ### branches
8
-
9
- Tracks which branches have been analyzed.
10
-
11
- | Column | Type | Description |
12
- |--------|------|-------------|
13
- | id | integer | Primary key |
14
- | name | string | Branch name (e.g., "main", "develop") |
15
- | last_analyzed_sha | string | SHA of last commit analyzed for incremental updates |
16
- | created_at | datetime | |
17
- | updated_at | datetime | |
18
-
19
- Indexes: `name` (unique)
20
-
21
- ### commits
22
-
23
- Stores commit metadata for commits that have been analyzed.
24
-
25
- | Column | Type | Description |
26
- |--------|------|-------------|
27
- | id | integer | Primary key |
28
- | sha | string | Full commit SHA |
29
- | message | text | Commit message |
30
- | author_name | string | Author name |
31
- | author_email | string | Author email |
32
- | committed_at | datetime | Commit timestamp |
33
- | has_dependency_changes | boolean | True if this commit modified dependencies |
34
- | created_at | datetime | |
35
- | updated_at | datetime | |
36
-
37
- Indexes: `sha` (unique)
38
-
39
- ### branch_commits
40
-
41
- Join table linking commits to branches. A commit can belong to multiple branches.
42
-
43
- | Column | Type | Description |
44
- |--------|------|-------------|
45
- | id | integer | Primary key |
46
- | branch_id | integer | Foreign key to branches |
47
- | commit_id | integer | Foreign key to commits |
48
- | position | integer | Order of commit in branch history |
49
-
50
- Indexes: `(branch_id, commit_id)` (unique)
51
-
52
- ### manifests
53
-
54
- Stores manifest file metadata.
55
-
56
- | Column | Type | Description |
57
- |--------|------|-------------|
58
- | id | integer | Primary key |
59
- | path | string | File path (e.g., "Gemfile", "package.json") |
60
- | platform | string | Package manager (e.g., "rubygems", "npm") |
61
- | kind | string | Manifest type (e.g., "manifest", "lockfile") |
62
- | created_at | datetime | |
63
- | updated_at | datetime | |
64
-
65
- Indexes: `path`
66
-
67
- ### dependency_changes
68
-
69
- Records each dependency addition, modification, or removal.
70
-
71
- | Column | Type | Description |
72
- |--------|------|-------------|
73
- | id | integer | Primary key |
74
- | commit_id | integer | Foreign key to commits |
75
- | manifest_id | integer | Foreign key to manifests |
76
- | name | string | Package name |
77
- | platform | string | Package manager |
78
- | change_type | string | "added", "modified", or "removed" |
79
- | requirement | string | Version constraint after change |
80
- | previous_requirement | string | Version constraint before change (for modifications) |
81
- | dependency_type | string | "runtime", "development", etc. |
82
- | created_at | datetime | |
83
- | updated_at | datetime | |
84
-
85
- Indexes: `name`, `platform`, `(commit_id, name)`
86
-
87
- ### dependency_snapshots
88
-
89
- Stores the complete dependency state at each commit that has changes. Enables O(1) queries for "what dependencies existed at commit X" without replaying history.
90
-
91
- | Column | Type | Description |
92
- |--------|------|-------------|
93
- | id | integer | Primary key |
94
- | commit_id | integer | Foreign key to commits |
95
- | manifest_id | integer | Foreign key to manifests |
96
- | name | string | Package name |
97
- | platform | string | Package manager |
98
- | requirement | string | Version constraint |
99
- | dependency_type | string | "runtime", "development", etc. |
100
- | created_at | datetime | |
101
- | updated_at | datetime | |
102
-
103
- Indexes: `(commit_id, manifest_id, name)` (unique), `name`, `platform`
104
-
105
- ## Relationships
106
-
107
- ```
108
- branches ──┬── branch_commits ──┬── commits
109
- │ │
110
- │ ├── dependency_changes ──── manifests
111
- │ │
112
- │ └── dependency_snapshots ── manifests
113
-
114
- └── last_analyzed_sha (references commits.sha)
115
- ```
116
-
117
- ## Design Notes
118
-
119
- **Why snapshots?**
120
-
121
- Without snapshots, answering "what dependencies existed at commit X" requires replaying all changes from the beginning. With snapshots, it's a single query. The tradeoff is storage space, but SQLite handles this well.
122
-
123
- **Why branch_commits?**
124
-
125
- Git commits are branch-agnostic. The same commit can appear on multiple branches. This join table tracks which commits belong to which branches and their order, enabling branch-specific queries.
126
-
127
- **Platform field duplication**
128
-
129
- The platform appears in both `manifests` and `dependency_changes`/`dependency_snapshots`. This denormalization speeds up queries that filter by platform without requiring joins.