faultline 0.1.0__tar.gz

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 (34) hide show
  1. faultline-0.1.0/.gitignore +54 -0
  2. faultline-0.1.0/LICENSE +183 -0
  3. faultline-0.1.0/PKG-INFO +329 -0
  4. faultline-0.1.0/README.md +298 -0
  5. faultline-0.1.0/docs/index.html +804 -0
  6. faultline-0.1.0/faultline/__init__.py +1 -0
  7. faultline-0.1.0/faultline/analyzer/__init__.py +0 -0
  8. faultline-0.1.0/faultline/analyzer/ast_extractor.py +225 -0
  9. faultline-0.1.0/faultline/analyzer/cochange_detector.py +198 -0
  10. faultline-0.1.0/faultline/analyzer/coverage.py +50 -0
  11. faultline-0.1.0/faultline/analyzer/features.py +459 -0
  12. faultline-0.1.0/faultline/analyzer/git.py +251 -0
  13. faultline-0.1.0/faultline/analyzer/import_graph.py +274 -0
  14. faultline-0.1.0/faultline/cli.py +457 -0
  15. faultline-0.1.0/faultline/llm/__init__.py +0 -0
  16. faultline-0.1.0/faultline/llm/detector.py +1459 -0
  17. faultline-0.1.0/faultline/llm/flow_detector.py +444 -0
  18. faultline-0.1.0/faultline/models/__init__.py +0 -0
  19. faultline-0.1.0/faultline/models/types.py +80 -0
  20. faultline-0.1.0/faultline/output/__init__.py +0 -0
  21. faultline-0.1.0/faultline/output/reporter.py +174 -0
  22. faultline-0.1.0/faultline/output/writer.py +38 -0
  23. faultline-0.1.0/memory/MEMORY.md +111 -0
  24. faultline-0.1.0/pyproject.toml +57 -0
  25. faultline-0.1.0/tests/__init__.py +0 -0
  26. faultline-0.1.0/tests/test_ast_extractor.py +148 -0
  27. faultline-0.1.0/tests/test_cochange_detector.py +155 -0
  28. faultline-0.1.0/tests/test_coverage.py +60 -0
  29. faultline-0.1.0/tests/test_features.py +684 -0
  30. faultline-0.1.0/tests/test_flow_detector.py +190 -0
  31. faultline-0.1.0/tests/test_git.py +501 -0
  32. faultline-0.1.0/tests/test_import_graph.py +515 -0
  33. faultline-0.1.0/tests/test_llm_detector.py +183 -0
  34. faultline-0.1.0/tests/test_writer.py +57 -0
@@ -0,0 +1,54 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.so
7
+ *.egg
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ .eggs/
12
+ wheels/
13
+
14
+ # Virtual environments
15
+ .venv/
16
+ venv/
17
+ env/
18
+ ENV/
19
+
20
+ # Testing
21
+ .pytest_cache/
22
+ .coverage
23
+ coverage.xml
24
+ htmlcov/
25
+ .tox/
26
+
27
+ # Type checking
28
+ .mypy_cache/
29
+ .pyright/
30
+
31
+ # featuremap output
32
+ .featuremap/
33
+ .faultline
34
+
35
+ # IDE
36
+ .vscode/
37
+ .idea/
38
+ *.swp
39
+ *.swo
40
+ .DS_Store
41
+
42
+ # Secrets
43
+ .env
44
+ .env.local
45
+ .env.*
46
+ *.key
47
+
48
+ # Hatch
49
+ .hatch/
50
+
51
+ # Dev dashboard (personal use only)
52
+ dashboard/
53
+
54
+
@@ -0,0 +1,183 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as defined by Sections 1 through 9 of this
48
+ document, any work of authorship, including the original version of
49
+ the Work and any modifications or additions to that Work or Derivative
50
+ Works of the Work, intentionally submitted to the Licensor for
51
+ inclusion in the Work by the copyright owner or by an individual or
52
+ Legal Entity authorized to submit on behalf of the copyright owner.
53
+ For the purposes of this definition, "submitted" means any form of
54
+ electronic, verbal, or written communication sent to the Licensor or
55
+ its representatives, including but not limited to communication on
56
+ electronic mailing lists, source code control systems, and issue
57
+ tracking systems that are managed by, or on behalf of, the Licensor
58
+ for the purpose of discussing and improving the Work, but excluding
59
+ communication that is conspicuously marked or otherwise designated
60
+ in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
63
+ whom a Contribution has been received by the Licensor and incorporated
64
+ within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by the combined contribution of their
81
+ Contribution(s) with the Work to which such Contribution(s) was
82
+ submitted. If You institute patent litigation against any entity
83
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
84
+ the Work or any Contribution embodied within the Work constitutes
85
+ direct or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate as
87
+ of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, You must include a readable copy of the
108
+ attribution notices contained within such NOTICE file, in
109
+ at least one of the following places: within a NOTICE text
110
+ file distributed as part of the Derivative Works; within
111
+ the Source form or documentation, if provided along with the
112
+ Derivative Works; or, within a display generated by the
113
+ Derivative Works, if and wherever such third-party notices
114
+ normally appear. The contents of the NOTICE file are for
115
+ informational purposes only and do not modify the License.
116
+ You may add Your own attribution notices within Derivative
117
+ Works that You distribute, alongside or in addition to the
118
+ NOTICE text from the Work, provided that such additional
119
+ attribution notices cannot be construed as modifying the License.
120
+
121
+ You may add Your own license statement for Your modifications and
122
+ may provide additional grant of rights to use, copy, modify, merge,
123
+ publish, distribute, sublicense, and/or sell copies of the
124
+ Contributions, and to permit persons to whom the Contributions are
125
+ furnished to do so.
126
+
127
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
128
+ any Contribution intentionally submitted for inclusion in the Work
129
+ by You to the Licensor shall be under the terms and conditions of
130
+ this License, without any additional terms or conditions.
131
+ Notwithstanding the above, nothing herein shall supersede or modify
132
+ the terms of any separate license agreement you may have executed
133
+ with Licensor regarding such Contributions.
134
+
135
+ 6. Trademarks. This License does not grant permission to use the trade
136
+ names, trademarks, service marks, or product names of the Licensor,
137
+ except as required for reasonable and customary use in describing the
138
+ origin of the Work and reproducing the content of the NOTICE file.
139
+
140
+ 7. Disclaimer of Warranty. Unless required by applicable law or
141
+ agreed to in writing, Licensor provides the Work (and each
142
+ Contributor provides its Contributions) on an "AS IS" BASIS,
143
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
144
+ implied, including, without limitation, any warranties or conditions
145
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
146
+ PARTICULAR PURPOSE. You are solely responsible for determining the
147
+ appropriateness of using or reproducing the Work and assume any
148
+ risks associated with Your exercise of permissions under this License.
149
+
150
+ 8. Limitation of Liability. In no event and under no legal theory,
151
+ whether in tort (including negligence), contract, or otherwise,
152
+ unless required by applicable law (such as deliberate and grossly
153
+ negligent acts) or agreed to in writing, shall any Contributor be
154
+ liable to You for damages, including any direct, indirect, special,
155
+ incidental, or exemplary damages of any character arising as a
156
+ result of this License or out of the use or inability to use the
157
+ Work (including but not limited to damages for loss of goodwill,
158
+ work stoppage, computer failure or malfunction, or all other
159
+ commercial damages or losses), even if such Contributor has been
160
+ advised of the possibility of such damages.
161
+
162
+ 9. Accepting Warranty or Additional Liability. While redistributing
163
+ the Work or Derivative Works thereof, You may choose to offer,
164
+ and charge a fee for, acceptance of support, warranty, indemnity,
165
+ or other liability obligations and/or rights consistent with this
166
+ License. However, in accepting such obligations, You may offer only
167
+ conditions consistent with the terms of this License.
168
+
169
+ END OF TERMS AND CONDITIONS
170
+
171
+ Copyright 2026 pashaSchool
172
+
173
+ Licensed under the Apache License, Version 2.0 (the "License");
174
+ you may not use this file except in compliance with the License.
175
+ You may obtain a copy of the License at
176
+
177
+ http://www.apache.org/licenses/LICENSE-2.0
178
+
179
+ Unless required by applicable law or agreed to in writing, software
180
+ distributed under the License is distributed on an "AS IS" BASIS,
181
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182
+ See the License for the specific language governing permissions and
183
+ limitations under the License.
@@ -0,0 +1,329 @@
1
+ Metadata-Version: 2.4
2
+ Name: faultline
3
+ Version: 0.1.0
4
+ Summary: Map features in any codebase from git history. No Jira required.
5
+ Project-URL: Homepage, https://github.com/pkuzina/faultline
6
+ Project-URL: Repository, https://github.com/pkuzina/faultline
7
+ Project-URL: Issues, https://github.com/pkuzina/faultline/issues
8
+ Author: FeatureMap Team
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: bug-fix-ratio,code-analysis,engineering-metrics,features,git,health-score,technical-debt
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: anthropic>=0.25.0
24
+ Requires-Dist: gitpython>=3.1.40
25
+ Requires-Dist: pydantic>=2.5.0
26
+ Requires-Dist: rich>=13.7.0
27
+ Requires-Dist: typer>=0.12.0
28
+ Provides-Extra: ollama
29
+ Requires-Dist: ollama>=0.4.0; extra == 'ollama'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # faultline
33
+
34
+ > Turn your git history into a feature risk map — no Jira required.
35
+
36
+ **faultline** analyzes your git commit history to automatically detect features and modules in your codebase, then shows which ones are accumulating the most bug fixes — your technical debt hotspots.
37
+
38
+ No integrations. No configuration. Just point it at any git repo.
39
+
40
+ ---
41
+
42
+ ## Why faultline?
43
+
44
+ Engineering managers need to know *where* the technical debt is before they can act on it. Most tools require you to tag tickets in Jira or Linear. faultline reads the truth directly from your git history.
45
+
46
+ ```
47
+ ✗ payments — health: 23 38 bug fixes / 112 commits (33.9%)
48
+ ! auth — health: 54 12 bug fixes / 48 commits (25.0%)
49
+ ✓ dashboard — health: 91 2 bug fixes / 67 commits (3.0%)
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Installation
55
+
56
+ ### From source
57
+
58
+ ```bash
59
+ git clone https://github.com/pkuzina/faultline
60
+ cd faultline
61
+ pip install -e .
62
+ ```
63
+
64
+ ### With Ollama support
65
+
66
+ ```bash
67
+ pip install -e '.[ollama]'
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Quick Start
73
+
74
+ ```bash
75
+ # Analyze the current directory
76
+ faultline analyze .
77
+
78
+ # Analyze a specific repo
79
+ faultline analyze ./path/to/repo
80
+
81
+ # Focus on a source subdirectory (recommended for frontend/monorepo projects)
82
+ faultline analyze . --src src/
83
+
84
+ # Last 90 days, show top 5 risk zones
85
+ faultline analyze . --days 90 --top 5
86
+
87
+ # Just print, don't save
88
+ faultline analyze . --no-save
89
+
90
+ # AI-powered semantic feature detection
91
+ faultline analyze . --llm --src src/
92
+
93
+ # AI feature detection with flow breakdown
94
+ faultline analyze . --llm --flows --src src/
95
+ ```
96
+
97
+ ---
98
+
99
+ ## AI-Powered Feature Detection
100
+
101
+ By default faultline groups files by directory structure (fast, no API needed). With `--llm` enabled, Claude or a local Ollama model reads the full file tree and returns a **semantic feature map** — grouping files by business domain, not folder names.
102
+
103
+ ```
104
+ Without --llm: "components", "views", "hooks" ← technical layers
105
+ With --llm: "user-auth", "payments", "dashboard" ← business features
106
+ ```
107
+
108
+ ### Anthropic Claude (cloud)
109
+
110
+ ```bash
111
+ # Pass your API key directly
112
+ faultline analyze . --llm --api-key sk-ant-...
113
+
114
+ # Or use an environment variable
115
+ export ANTHROPIC_API_KEY=sk-ant-...
116
+ faultline analyze . --llm
117
+
118
+ # Recommended for large projects — focus on source files only
119
+ faultline analyze . --llm --src src/
120
+ ```
121
+
122
+ Get your API key at [console.anthropic.com](https://console.anthropic.com) → API Keys.
123
+ Uses **Claude Haiku** for cost-efficient analysis (~$0.001 per repo).
124
+
125
+ ### Ollama (local, free, private)
126
+
127
+ Run analysis entirely on your machine — no API key, no data leaves your computer.
128
+ Recommended for private repositories.
129
+
130
+ ```bash
131
+ # 1. Install Ollama
132
+ brew install ollama # macOS
133
+ # or: curl -fsSL https://ollama.com/install.sh | sh
134
+
135
+ # 2. Pull the recommended model (one time, ~4.7 GB)
136
+ ollama pull llama3.1:8b
137
+
138
+ # 3. Start the server
139
+ ollama serve
140
+
141
+ # 4. Install the ollama package
142
+ pip install -e '.[ollama]'
143
+
144
+ # 5. Run
145
+ faultline analyze . --llm --provider ollama --src src/
146
+ ```
147
+
148
+ ### Recommended models
149
+
150
+ | Model | Size | Semantic quality | Notes |
151
+ |-------|------|-----------------|-------|
152
+ | `llama3.1:8b` | 4.7 GB | ★★★★★ | **Default — best balance of quality and size** |
153
+ | `mistral-nemo:12b` | 7.1 GB | ★★★★★ | Best overall quality, higher RAM requirement |
154
+ | `qwen2.5:7b` | 4.7 GB | ★★★★ | Good alternative |
155
+ | `llama3.2:3b` | 2.0 GB | ★★★ | Use when RAM is limited |
156
+
157
+ ```bash
158
+ # Best quality (requires ~8 GB RAM)
159
+ ollama pull mistral-nemo:12b
160
+ faultline analyze . --llm --provider ollama --model mistral-nemo:12b
161
+
162
+ # Lightweight option
163
+ ollama pull llama3.2:3b
164
+ faultline analyze . --llm --provider ollama --model llama3.2:3b
165
+ ```
166
+
167
+ The API key is validated **before** the analysis starts — no waiting to discover a bad key.
168
+ Falls back silently to heuristic mode if the LLM is unavailable.
169
+
170
+ ---
171
+
172
+ ## Flow Detection
173
+
174
+ With `--flows`, faultline goes one level deeper — breaking each feature into **user-facing flows**: named end-to-end sequences of actions (e.g. `checkout-flow`, `refund-flow`).
175
+
176
+ Requires `--llm`. Works with both Anthropic and Ollama.
177
+
178
+ ```bash
179
+ faultline analyze . --llm --flows --src src/
180
+ faultline analyze . --llm --provider ollama --flows --src src/
181
+ ```
182
+
183
+ Output shows two tables: features overview, then features with nested flows:
184
+
185
+ ```
186
+ Features by Risk
187
+ ╭──────────────┬────────┬─────────┬───────────┬────────╮
188
+ │ Feature │ Health │ Commits │ Bug Fixes │ Bug % │
189
+ ├──────────────┼────────┼─────────┼───────────┼────────┤
190
+ │ payments │ 23 │ 112 │ 38 │ 33.9% │
191
+ │ auth │ 54 │ 48 │ 12 │ 25.0% │
192
+ ╰──────────────┴────────┴─────────┴───────────┴────────╯
193
+
194
+ Feature & Flow Map by Risk
195
+ ╭──────┬────────────────────────┬────────┬─────────┬───────────╮
196
+ │ │ Feature / Flow │ Health │ Commits │ Bug Fixes │
197
+ ├──────┼────────────────────────┼────────┼─────────┼───────────┤
198
+ │ ✗ │ payments │ 23 │ 112 │ 38 │
199
+ │ │ ├─ checkout-flow │ 18 │ 67 │ 28 │
200
+ │ │ └─ refund-flow │ 41 │ 45 │ 10 │
201
+ │ ! │ auth │ 54 │ 48 │ 12 │
202
+ │ │ └─ login-flow │ 54 │ 48 │ 12 │
203
+ ╰──────┴────────────────────────┴────────┴─────────┴───────────╯
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Focusing on a Subdirectory
209
+
210
+ Use `--src` to restrict analysis to a specific folder. Everything outside that path is ignored.
211
+
212
+ ```bash
213
+ # Sources in src/
214
+ faultline analyze . --src src/
215
+
216
+ # Sources in app/
217
+ faultline analyze . --src app/
218
+
219
+ # Monorepo — analyze one package
220
+ faultline analyze . --src packages/api/src/
221
+ ```
222
+
223
+ Automatically excluded regardless of location:
224
+ - Dependencies: `node_modules/`, `vendor/`, `.venv/`
225
+ - Build output: `dist/`, `build/`, `.next/`, `coverage/`
226
+ - Tooling: `.github/`, `.husky/`, `.storybook/`, `.circleci/`
227
+ - Binary and generated files: `.map`, `.lock`, `.woff`, `.ttf`
228
+
229
+ ---
230
+
231
+ ## Output
232
+
233
+ ### Terminal
234
+
235
+ ```
236
+ ╭──────────────────────────────────────────────╮
237
+ │ FeatureMap Analysis │
238
+ │ │
239
+ │ Repository: /path/to/repo │
240
+ │ Analyzed: last 365 days │
241
+ │ Total commits: 847 │
242
+ │ Features found: 12 │
243
+ │ Bug fix commits: 143 │
244
+ │ Average health score: 61.3/100 │
245
+ ╰──────────────────────────────────────────────╯
246
+ ```
247
+
248
+ ### JSON
249
+
250
+ Results are saved to `.faultline/feature-map.json` by default:
251
+
252
+ ```json
253
+ {
254
+ "repo_path": "/path/to/repo",
255
+ "analyzed_at": "2026-02-22T10:00:00Z",
256
+ "total_commits": 847,
257
+ "date_range_days": 365,
258
+ "features": [
259
+ {
260
+ "name": "payments",
261
+ "description": "Handles Stripe payment processing and subscription billing.",
262
+ "health_score": 23.0,
263
+ "bug_fix_ratio": 0.339,
264
+ "bug_fixes": 38,
265
+ "total_commits": 112,
266
+ "authors": ["alice", "bob"],
267
+ "paths": ["src/payments/stripe.py", "src/payments/webhooks.py"],
268
+ "flows": [
269
+ {
270
+ "name": "checkout-flow",
271
+ "health_score": 18.0,
272
+ "bug_fixes": 28,
273
+ "total_commits": 67
274
+ }
275
+ ]
276
+ }
277
+ ]
278
+ }
279
+ ```
280
+
281
+ ---
282
+
283
+ ## CLI Reference
284
+
285
+ ### `faultline analyze [REPO_PATH]`
286
+
287
+ | Flag | Default | Description |
288
+ |------|---------|-------------|
289
+ | `--src` | — | Subdirectory to focus on, e.g. `src/` or `app/` |
290
+ | `--days` | `365` | Days of git history to analyze |
291
+ | `--max-commits` | `5000` | Maximum commits to read |
292
+ | `--top` | `3` | Number of top risk zones to highlight |
293
+ | `--output` | `.faultline/feature-map.json` | Output file path |
294
+ | `--no-save` | — | Skip saving JSON output |
295
+ | `--llm` | `false` | Use AI for semantic feature detection |
296
+ | `--flows` | `false` | Detect user-facing flows within features (requires `--llm`) |
297
+ | `--provider` | `anthropic` | LLM provider: `anthropic` or `ollama` |
298
+ | `--model` | — | Model override (default: `claude-haiku-4-5` / `qwen2.5-coder:7b`) |
299
+ | `--api-key` | env | Anthropic API key (`ANTHROPIC_API_KEY` env var) |
300
+ | `--ollama-url` | `http://localhost:11434` | Custom Ollama server URL |
301
+
302
+ ---
303
+
304
+ ## How It Works
305
+
306
+ 1. **Reads git history** — up to `--max-commits` commits within the requested date range
307
+ 2. **Collects tracked files** — respects `--src` filter, skips build output and tooling
308
+ 3. **Maps files to features** — two modes:
309
+ - **Heuristic** (default): groups by directory structure (`src/payments/` → `payments`)
310
+ - **LLM** (`--llm`): sends the file tree to Claude or Ollama, gets back a semantic `{feature: [files]}` mapping by business domain
311
+ 4. **Scans commit history** — for each feature, counts total commits and bug fix commits
312
+ 5. **Calculates health scores** — `100 - (bug_fix_ratio × 200)`, weighted by commit activity
313
+ 6. **Detects flows** (`--flows`): analyzes files within each feature and maps them to named user-facing journeys
314
+
315
+ ---
316
+
317
+ ## Health Score
318
+
319
+ | Score | Status | Meaning |
320
+ |-------|--------|---------|
321
+ | 75–100 | ✓ Green | Healthy — low bug fix ratio |
322
+ | 50–74 | ! Yellow | Watch — moderate technical debt |
323
+ | 0–49 | ✗ Red | Critical — high bug fix ratio |
324
+
325
+ ---
326
+
327
+ ## License
328
+
329
+ [Apache 2.0](LICENSE)