chronicle-devkit 0.1.0__py3-none-any.whl

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 (61) hide show
  1. chronicle/__init__.py +1 -0
  2. chronicle/ai/__init__.py +0 -0
  3. chronicle/ai/base.py +7 -0
  4. chronicle/ai/factory.py +23 -0
  5. chronicle/ai/google_ai.py +14 -0
  6. chronicle/ai/openai.py +14 -0
  7. chronicle/analysis/__init__.py +0 -0
  8. chronicle/analysis/analyzers/__init__.py +0 -0
  9. chronicle/analysis/analyzers/base.py +15 -0
  10. chronicle/analysis/analyzers/django_migrations.py +74 -0
  11. chronicle/analysis/analyzers/git.py +37 -0
  12. chronicle/analysis/context.py +12 -0
  13. chronicle/analysis/engine.py +18 -0
  14. chronicle/cli/__init__.py +1 -0
  15. chronicle/cli/commands/__init__.py +0 -0
  16. chronicle/cli/commands/analyze.py +73 -0
  17. chronicle/cli/commands/config.py +79 -0
  18. chronicle/cli/commands/init.py +47 -0
  19. chronicle/cli/commands/interpret.py +48 -0
  20. chronicle/cli/commands/scan.py +87 -0
  21. chronicle/cli/commands/show.py +106 -0
  22. chronicle/cli/commands/status.py +26 -0
  23. chronicle/cli/commands/version.py +6 -0
  24. chronicle/cli/main.py +30 -0
  25. chronicle/config/__init__.py +0 -0
  26. chronicle/config/credentials.py +17 -0
  27. chronicle/config/loader.py +21 -0
  28. chronicle/config/manager.py +52 -0
  29. chronicle/integrations/__init__.py +0 -0
  30. chronicle/integrations/git.py +16 -0
  31. chronicle/interpretation/__init__.py +0 -0
  32. chronicle/interpretation/context.py +8 -0
  33. chronicle/interpretation/context_builder.py +147 -0
  34. chronicle/interpretation/interpreter.py +12 -0
  35. chronicle/interpretation/prompts.py +51 -0
  36. chronicle/project/__init__.py +0 -0
  37. chronicle/project/discovery.py +9 -0
  38. chronicle/project/initializer.py +45 -0
  39. chronicle/project/status.py +25 -0
  40. chronicle/scanning/__init__.py +0 -0
  41. chronicle/scanning/context.py +10 -0
  42. chronicle/scanning/engine.py +16 -0
  43. chronicle/scanning/scanners/__init__.py +0 -0
  44. chronicle/scanning/scanners/base.py +17 -0
  45. chronicle/scanning/scanners/django_migrations.py +156 -0
  46. chronicle/scanning/scanners/django_model.py +12 -0
  47. chronicle/scanning/scanners/git.py +94 -0
  48. chronicle/scanning/scanners/git_models.py +6 -0
  49. chronicle/storage/__init__.py +0 -0
  50. chronicle/storage/analysis_state.py +44 -0
  51. chronicle/storage/database.py +9 -0
  52. chronicle/storage/findings.py +53 -0
  53. chronicle/storage/models.py +20 -0
  54. chronicle/storage/observations.py +93 -0
  55. chronicle/storage/scan_state.py +44 -0
  56. chronicle/storage/schema.py +47 -0
  57. chronicle_devkit-0.1.0.dist-info/METADATA +233 -0
  58. chronicle_devkit-0.1.0.dist-info/RECORD +61 -0
  59. chronicle_devkit-0.1.0.dist-info/WHEEL +5 -0
  60. chronicle_devkit-0.1.0.dist-info/entry_points.txt +2 -0
  61. chronicle_devkit-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: chronicle-devkit
3
+ Version: 0.1.0
4
+ Summary: A local first developer intelligence tool
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: typer>=0.16
8
+ Requires-Dist: tomli-w>=1.2.0
9
+ Requires-Dist: openai>=3.6.0
10
+ Requires-Dist: nltk>=3.10.3
11
+ Requires-Dist: google-genai>=2.20.0
12
+ Requires-Dist: keyring>=25.7.0
13
+ Requires-Dist: tomli>=2.0.0; python_version < "3.11"
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=8.0; extra == "dev"
16
+
17
+ # Chronicle
18
+
19
+ **Local-first developer intelligence.** Chronicle records how a software project changes over time, turns that history into signals, and lets you ask questions about it — all stored and analyzed on your own machine.
20
+
21
+ Chronicle fits naturally into your existing workflow. Point it at a Git project, and it:
22
+
23
+ 1. **Scans** your project's history into structured *observations* (git commits, Django migrations).
24
+ 2. **Analyzes** those observations into actionable *findings* (new files, changed schema fields …).
25
+ 3. **Interprets** the collected history with AI, answering questions in plain language.
26
+
27
+ ## How it works
28
+
29
+ ```
30
+ git history ──► scan ──► observations ──► analyze ──► findings ──► interpret (AI) ──► answers
31
+ Django migrations ─┘ local SQLite ▲
32
+ keywords + related commits
33
+ ```
34
+
35
+ - **Local-first** — everything lives in a `.chronicle/` folder inside your project. No accounts, no cloud sync, no telemetry. Your `chronicle.db` stays yours.
36
+ - **Incremental** — Chronicle remembers how far it got (`scan_state` for scanners, `analysis_state` for analyzers) so repeated runs only process what's new.
37
+ - **Extensible** — scanners (`Scanner`) and analyzers (`BaseAnalyzer`) are pluggable; providers are pluggable too (OpenAI / Gemini).
38
+
39
+ ## Requirements
40
+
41
+ - **Python 3.10+**
42
+ - A **Git** repository (the project root is detected by walking up to the nearest `.git` directory)
43
+ - `pip` via the `dev` extra for running tests
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ # clone and enter the repository
49
+ git clone https://github.com/Sakshyam-Xtha/Chronicle.git
50
+ cd Chronicle
51
+
52
+ # create a virtual environment (optional but recommended)
53
+ python -m venv .venv
54
+ source .venv/bin/activate
55
+
56
+ # install in editable mode (includes the `chronicle` command)
57
+ pip install -e ".[dev]"
58
+ ```
59
+
60
+ Verify the CLI is on your path:
61
+
62
+ ```bash
63
+ chronicle version # -> Chronicle 0.1.0
64
+ ```
65
+
66
+ ## Quick start
67
+
68
+ ```bash
69
+ # 1. Initialize Chronicle in a project (creates .chronicle/ + local DB)
70
+ cd /path/to/your/project
71
+ chronicle init
72
+
73
+ # 2. Scan the project history into observations
74
+ chronicle scan
75
+
76
+ # 3. Browse what was recorded
77
+ chronicle show
78
+ chronicle show --id 1
79
+
80
+ # 4. Analyze observations into findings
81
+ chronicle analyze
82
+
83
+ # 5. Ask questions about your history (requires an AI provider/key)
84
+ chronicle interpret --question "When did we add the User model?"
85
+ ```
86
+
87
+ > `init`, `scan`, and `show` need no configuration. Only `interpret` requires an AI provider.
88
+
89
+ ## Command reference
90
+
91
+ | Command | Description |
92
+ | --- | --- |
93
+ | `chronicle init` | Create the `.chronicle/` directory and initialize the local database |
94
+ | `chronicle scan` | Scan project history into observations (git commits, Django migrations) |
95
+ | `chronicle show` | List all observations; `--id <n>` shows one observation in detail |
96
+ | `chronicle analyze` | Turn observations into findings via the installed analyzers |
97
+ | `chronicle interpret --question "<text>"` | Ask an AI-backed question about the project history |
98
+ | `chronicle config` | View current configuration; `set provider` / `set model` to configure AI |
99
+ | `chronicle status` | Show whether the project is initialized and detected |
100
+ | `chronicle version` | Print the Chronicle version |
101
+
102
+ ### `chronicle status`
103
+
104
+ ```bash
105
+ $ chronicle status
106
+ Project: my-project
107
+ Root: /path/to/my-project
108
+ Git: detected
109
+ Chronicle: initialized
110
+ Configuration: found
111
+ ```
112
+
113
+ ### `chronicle show`
114
+
115
+ Without arguments it prints a compact table of all observations. With `--id <n>` it renders a detailed view:
116
+
117
+ ```text
118
+ Observation #1
119
+ ────────────────────────────────────────────
120
+ Source: git
121
+ Type: commit
122
+ External ID: 9f8d3a1
123
+ Timestamp: 2026-08-21 12:00:00 UTC
124
+
125
+ Data
126
+ ────────────────────────────────────────────
127
+ ```
128
+ Migration observations additionally show **App**, **Migration**, **Dependencies**, and **Operations** (model / field per operation).
129
+
130
+ ## Configuring AI (for `interpret`)
131
+
132
+ Chronicle reads its configuration from `.chronicle/config.toml`:
133
+
134
+ ```toml
135
+ [chronicle]
136
+ version = 1
137
+
138
+ [ai]
139
+ provider = ""
140
+ model = ""
141
+ ```
142
+
143
+ Set the provider and model:
144
+
145
+ ```bash
146
+ chronicle config set provider openai
147
+ chronicle config set model gpt-4o
148
+ ```
149
+
150
+ Then export your API key as an environment variable:
151
+
152
+ ```bash
153
+ export OPENAI_API_KEY="sk-..." # provider: openai
154
+ export GEMINI_API_KEY="..." # provider: gemini
155
+ ```
156
+
157
+ Check everything is wired up:
158
+
159
+ ```bash
160
+ chronicle config
161
+ ```
162
+
163
+ ## What gets recorded
164
+
165
+ ### Git commits (`scan`)
166
+
167
+ Each commit becomes an observation with:
168
+
169
+ - `hash`, `message`, `author`
170
+ - `parents` (empty for the root commit, one or more for merges)
171
+ - `changes` — per-file **status** (`A` added, `M` modified, `D` deleted) and **path**
172
+
173
+ ### Django migrations (`scan`)
174
+
175
+ Every `migrations/*.py` file (ignoring `.git`, `.venv`, `venv`, `env`, `node_modules`, `__pycache__`) is parsed with `ast` into an observation with:
176
+
177
+ - `app` (application label), `name` (migration name)
178
+ - `dependencies`
179
+ - `operations` — e.g. `AddField`, `RemoveField` with model / field details
180
+
181
+ ### Findings (`analyze`)
182
+
183
+ Analyzers turn observations into findings:
184
+
185
+ - **GitAnalyzer** — flags newly created files (`A`) with `severity: info`
186
+ - **DjangoMigrationAnalyzer** — flags `RemoveField` (`warning`) and `AddField` (`info`) operations
187
+
188
+ ## How interpretation works
189
+
190
+ `chronicle interpret` does **not** dump everything at the model. It:
191
+
192
+ 1. Tokenizes your question and drops stop words to extract keywords.
193
+ 2. Scores every finding by how well it matches those keywords (title, message, data).
194
+ 3. Picks the top 10 findings and their related git commits (e.g. the commit that introduced a migration).
195
+ 4. Builds a prompt with only that focused context and asks the configured provider.
196
+
197
+ ## Project layout
198
+
199
+ ```
200
+ src/chronicle/
201
+ ├── ai/ # AI provider abstraction (OpenAI, Gemini, factory)
202
+ ├── analysis/ # analyzers + engine that turn observations into findings
203
+ ├── cli/ # Typer CLI commands (`scan`, `show`, `analyze`, …)
204
+ ├── config/ # config.toml management + API key resolution
205
+ ├── integrations/ # thin wrappers (e.g. git)
206
+ ├── interpretation/ # question -> context -> prompt -> AI response
207
+ ├── project/ # discovery, initialization, status
208
+ ├── scanning/ # scanners + engine that collect observations
209
+ │ └── scanners/ # git, django_migrations and their models
210
+ └── storage/ # SQLite repositories + schema
211
+ ```
212
+
213
+ ## Development
214
+
215
+ Run the test suite:
216
+
217
+ ```bash
218
+ pip install -e ".[dev]"
219
+ pytest test/
220
+ ```
221
+
222
+ The suite is split into:
223
+
224
+ - `test/unit/` — fast, mocked tests (parsing, storage, contexts, models)
225
+ - `test/integration/` — real-git and end-to-end CLI tests (incremental scan checkpoints, migration parsing, merge parents)
226
+
227
+ ## Roadmap / status
228
+
229
+ Chronicle is an early-stage local-first tool (`0.1.0`). Current scanners cover **git** and **Django migrations**; analyzers cover **git file additions** and **Django schema changes**; AI interpretation supports **OpenAI** and **Gemini**.
230
+
231
+ ## License
232
+
233
+ Not yet specified.
@@ -0,0 +1,61 @@
1
+ chronicle/__init__.py,sha256=Pru0BlFBASFCFo7McHdohtKkUtgMPDwbGfyUZlE2_Vw,21
2
+ chronicle/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ chronicle/ai/base.py,sha256=CAbFspewJ3w-ZnexVNCqyPraNoi5jP_FaYpWY7UmUBY,208
4
+ chronicle/ai/factory.py,sha256=hYCJIYI_DSN1lgIZo7zEX_5sAIeJ_5rfNLyFrNTfZUA,558
5
+ chronicle/ai/google_ai.py,sha256=aOXmtdiR0r5lqZ2_HyaOhQac3MLx4uIuzqRgzLryW8k,494
6
+ chronicle/ai/openai.py,sha256=29u4-4vG6KKLOJc5XddMevYEXrk4LJaoIE5Tm2VoQ4c,432
7
+ chronicle/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ chronicle/analysis/context.py,sha256=bT2BQyjUnWQ2wbasbwe5JoozHRM_AIM2pByR2i7f8Fs,372
9
+ chronicle/analysis/engine.py,sha256=xDjAWhLURBgva0NjbDZ9SKknw7viwCXQHdEOuJMPgpw,595
10
+ chronicle/analysis/analyzers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ chronicle/analysis/analyzers/base.py,sha256=Ce8n36Onimo3--abrLgtXXBVan40VyOdH-Hh82E-ZJ8,511
12
+ chronicle/analysis/analyzers/django_migrations.py,sha256=jUlm4-2F6dry2b3D4z3g0rIwPW99HlIaixOL64uE89Y,2533
13
+ chronicle/analysis/analyzers/git.py,sha256=j83GpD5JL2Lg8EJKp9YrBd4RBEDLtK6Fpm5qa-n5VSI,1410
14
+ chronicle/cli/__init__.py,sha256=L6zbQIZKsAP-Knhm6fBcQFPoVdIDuejxze60qX23jiw,21
15
+ chronicle/cli/main.py,sha256=uZITs7cfhJg9oVHmAdpwis7-Faii8HLBWxCooF4sCSk,853
16
+ chronicle/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ chronicle/cli/commands/analyze.py,sha256=CmmJ9JVwm6PTar-CckJIn2GqEQ7XV4ONI2dvAMsadSw,2561
18
+ chronicle/cli/commands/config.py,sha256=aTYo35nN8fGRlqXkSs-9k8580E7W3eQ-uHf_D2zvd-E,2474
19
+ chronicle/cli/commands/init.py,sha256=9Ah1_Jm7c-hNU1ZH6310p_Vz-EmqCf3LsjzCUKGJc9Y,1863
20
+ chronicle/cli/commands/interpret.py,sha256=6LxpsMvtwTWkDyd9JmkDaKX9A4IIvH6gzmPKzGdv6UM,1809
21
+ chronicle/cli/commands/scan.py,sha256=1z-uFXclg_ZQRH6pp3cYwoZJDJtkczm9VSwLiXwPW7s,2816
22
+ chronicle/cli/commands/show.py,sha256=lr47IaMakNdUnp_iAESZv_LkG2azrcJTncj6glNx57k,3313
23
+ chronicle/cli/commands/status.py,sha256=M6TpEzFOAkuLDKUQIxe4CWViuQO14rmVKVzJ2Pzcuh0,881
24
+ chronicle/cli/commands/version.py,sha256=3J1vrNKrLNP6s5isl5hTGhI7GZ-Dz1V3cO7kfnl1FvQ,138
25
+ chronicle/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ chronicle/config/credentials.py,sha256=quu5dlHb4HZD4jJvVKZFskQE-6tf7XUum-WV6DvnQ7w,373
27
+ chronicle/config/loader.py,sha256=Ew6_-W3ye_Vzu-judLz2-4REF-GLIMFqY4zvmGR33Is,584
28
+ chronicle/config/manager.py,sha256=XX2AtDGkngLPpN8h5V0a8tBHJZi0knFsJCyNwRYrPGg,1212
29
+ chronicle/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
+ chronicle/integrations/git.py,sha256=VhVRFYsTjqenqpcT6C1UrEAP9rCeDs5K3Qn0iVdhoP8,395
31
+ chronicle/interpretation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ chronicle/interpretation/context.py,sha256=TvDz-biT-RiR252BnT5suqbAZF0nAc7ExWVOYLL8ZfM,215
33
+ chronicle/interpretation/context_builder.py,sha256=8xdxTZa6xFZB07dqJyjK5D7XHaeTqqPP4QZVBaug5Dg,4197
34
+ chronicle/interpretation/interpreter.py,sha256=KDRUkMhkhrtRBbC2t5MbDELhLhnXDOk-N_mYqzUc4JM,468
35
+ chronicle/interpretation/prompts.py,sha256=ekEe0Z1_BlSPO8F-V67GBHXbX54A5nBQeC7RnJTuA98,1150
36
+ chronicle/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ chronicle/project/discovery.py,sha256=Rw3XJoFFYRRIgdkmQ0AbNKUzbsp16U2Rg3n0xLi5n4g,309
38
+ chronicle/project/initializer.py,sha256=KawLd3fdCyki1eFADhzIJUawB0tyDUqS6HJtun7Oeyw,1474
39
+ chronicle/project/status.py,sha256=UkKn5MFKVo3tmMQ3sm795AipcA7JP24d54TsZbfiYQ8,691
40
+ chronicle/scanning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ chronicle/scanning/context.py,sha256=jR6kfgFixlV96HQwW3gFVSnR6t44tk8vFbhxSXMoFzA,260
42
+ chronicle/scanning/engine.py,sha256=YQXVElq4KAUcMh3edUUBzZLKOrcn1TO14QTHvqI3gpk,583
43
+ chronicle/scanning/scanners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
+ chronicle/scanning/scanners/base.py,sha256=PN6K9T3ozd0eDRvFjLIeSCq-CL747hfUx0DZsSJAkGY,489
45
+ chronicle/scanning/scanners/django_migrations.py,sha256=S-HXuYB8T-ckrU70fcuxCu95UlvWYy6LWIQEH8PTJ8U,5336
46
+ chronicle/scanning/scanners/django_model.py,sha256=QTY50VFwXsFPxy3Yo1Z2800p-KE5SxwmCGVvJfX8zSM,244
47
+ chronicle/scanning/scanners/git.py,sha256=a66-uykyJatdrbnBOK4ZAq0EWp2__fzm2dPHM-bgfxs,2955
48
+ chronicle/scanning/scanners/git_models.py,sha256=UdAAUcuylK-_gFfVyhN9M5ULJiXzkiXA350Jr4oTxy4,91
49
+ chronicle/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
+ chronicle/storage/analysis_state.py,sha256=0ygt7xD1b3L26YsOFHXUW7MpWD2wa7P336ehBBqrxOc,1143
51
+ chronicle/storage/database.py,sha256=k6GCtRvA-TKRkotZTJ07kCRGizXt0l3IsDYaLphILcc,287
52
+ chronicle/storage/findings.py,sha256=UWWI6--3UNbQ_azQeS-PagoEa17AvmM4WGgZI3uk9kc,1432
53
+ chronicle/storage/models.py,sha256=DLPMOrd-YqOwJwY_dazXSobSe0VjrdOIYYEAD9lUo_I,380
54
+ chronicle/storage/observations.py,sha256=ary3D-x44-7qw2nyq2E-RHdkl7UAXizISwzmPRxKt2w,2746
55
+ chronicle/storage/scan_state.py,sha256=NjsJZPGrvkC3pttRoIgfWVeshwPgg3_5s_ZItZpbXOs,1123
56
+ chronicle/storage/schema.py,sha256=3-BF09agnEpIMhXeyz8AWcztLG8ddDiQd5yIU7Bale0,1131
57
+ chronicle_devkit-0.1.0.dist-info/METADATA,sha256=dMoWzBvPPfip5i-R2DtNARFoVXxhuCiKncxttcWV_68,7757
58
+ chronicle_devkit-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
59
+ chronicle_devkit-0.1.0.dist-info/entry_points.txt,sha256=4Nyl9fwcb4SxUG-YcxJ7V5rRFbeXR7MsK7XpIFhpKKE,54
60
+ chronicle_devkit-0.1.0.dist-info/top_level.txt,sha256=4BFZDl1VGI4Dov1YUkhT3azSPsLl1YU14GEzl3fEBD8,10
61
+ chronicle_devkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ chronicle = chronicle.cli.main:main
@@ -0,0 +1 @@
1
+ chronicle