project-brain-cli 1.0.0__tar.gz → 1.1.1__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 (63) hide show
  1. project_brain_cli-1.1.1/PKG-INFO +675 -0
  2. project_brain_cli-1.1.1/README.md +647 -0
  3. project_brain_cli-1.1.1/pyproject.toml +64 -0
  4. project_brain_cli-1.1.1/src/project_brain/__init__.py +1 -0
  5. project_brain_cli-1.1.1/src/project_brain/cli.py +1566 -0
  6. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/cli_help.py +1 -1
  7. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/cli_ui.py +12 -0
  8. project_brain_cli-1.1.1/src/project_brain/community.py +43 -0
  9. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/config_loader.py +3 -3
  10. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/exporter.py +11 -31
  11. project_brain_cli-1.1.1/src/project_brain/docs/categories.py +16 -0
  12. project_brain_cli-1.1.1/src/project_brain/docs/config_schema.py +111 -0
  13. project_brain_cli-1.1.1/src/project_brain/docs/decorators.py +69 -0
  14. project_brain_cli-1.1.1/src/project_brain/docs/errors.py +55 -0
  15. project_brain_cli-1.1.1/src/project_brain/docs/gifs.py +10 -0
  16. project_brain_cli-1.1.1/src/project_brain/docs/personas.py +101 -0
  17. project_brain_cli-1.1.1/src/project_brain/docs/providers.py +30 -0
  18. project_brain_cli-1.1.1/src/project_brain/storage/__init__.py +0 -0
  19. project_brain_cli-1.1.1/src/project_brain_cli.egg-info/PKG-INFO +675 -0
  20. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain_cli.egg-info/SOURCES.txt +9 -0
  21. project_brain_cli-1.0.0/PKG-INFO +0 -1185
  22. project_brain_cli-1.0.0/README.md +0 -1167
  23. project_brain_cli-1.0.0/pyproject.toml +0 -40
  24. project_brain_cli-1.0.0/src/project_brain/__init__.py +0 -1
  25. project_brain_cli-1.0.0/src/project_brain/cli.py +0 -644
  26. project_brain_cli-1.0.0/src/project_brain_cli.egg-info/PKG-INFO +0 -1185
  27. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/LICENSE +0 -0
  28. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/setup.cfg +0 -0
  29. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/config/__init__.py +0 -0
  30. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/__init__.py +0 -0
  31. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/analyzer.py +0 -0
  32. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/differ.py +0 -0
  33. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor.py +0 -0
  34. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/analysis.py +0 -0
  35. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/environment.py +0 -0
  36. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/exports.py +0 -0
  37. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/llm.py +0 -0
  38. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/models.py +0 -0
  39. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/doctor_checks/repository.py +0 -0
  40. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/explainer.py +0 -0
  41. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/explainer_file.py +0 -0
  42. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/logger.py +0 -0
  43. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/results.py +0 -0
  44. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/core/summarizer.py +0 -0
  45. {project_brain_cli-1.0.0/src/project_brain/llm → project_brain_cli-1.1.1/src/project_brain/docs}/__init__.py +0 -0
  46. {project_brain_cli-1.0.0/src/project_brain/storage → project_brain_cli-1.1.1/src/project_brain/llm}/__init__.py +0 -0
  47. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/llm/provider.py +0 -0
  48. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain/storage/storage.py +0 -0
  49. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain_cli.egg-info/dependency_links.txt +0 -0
  50. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain_cli.egg-info/entry_points.txt +0 -0
  51. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain_cli.egg-info/requires.txt +0 -0
  52. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/src/project_brain_cli.egg-info/top_level.txt +0 -0
  53. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_cli.py +0 -0
  54. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_config.py +0 -0
  55. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_diff.py +0 -0
  56. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_edge_cases.py +0 -0
  57. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_explain.py +0 -0
  58. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_export.py +0 -0
  59. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_advanced_logging.py +0 -0
  60. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_analyzer.py +0 -0
  61. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_cli.py +0 -0
  62. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_config.py +0 -0
  63. {project_brain_cli-1.0.0 → project_brain_cli-1.1.1}/tests/test_diff.py +0 -0
@@ -0,0 +1,675 @@
1
+ Metadata-Version: 2.4
2
+ Name: project-brain-cli
3
+ Version: 1.1.1
4
+ Summary: Local-first developer intelligence CLI for semantic repository analysis and Git diff understanding.
5
+ Author: Srujan Amaragatti
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Srujan-Amaragatti05/project-brain
8
+ Project-URL: Repository, https://github.com/Srujan-Amaragatti05/project-brain
9
+ Project-URL: Issues, https://github.com/Srujan-Amaragatti05/project-brain/issues
10
+ Project-URL: Discussions, https://github.com/Srujan-Amaragatti05/project-brain/discussions
11
+ Keywords: cli,git,ast,developer-tools,code-analysis,llm,developer-productivity
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Environment :: Console
15
+ Classifier: Topic :: Software Development
16
+ Classifier: Topic :: Software Development :: Version Control :: Git
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: typer
21
+ Requires-Dist: rich
22
+ Requires-Dist: PyYAML
23
+ Requires-Dist: requests
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest; extra == "dev"
26
+ Requires-Dist: pytest-cov; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # 🧠 project-brain
30
+
31
+ > **Local-first developer intelligence CLI for semantic repository analysis, Git-aware code understanding, and AI-friendly engineering workflows.**
32
+
33
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
34
+ ![CLI](https://img.shields.io/badge/interface-CLI-black)
35
+ ![License](https://img.shields.io/badge/license-MIT-green)
36
+ ![Status](https://img.shields.io/badge/status-active-success)
37
+ ![Tests](https://github.com/Srujan-Amaragatti05/project-brain/actions/workflows/tests.yml/badge.svg)
38
+ ![PyPI](https://img.shields.io/pypi/v/project-brain-cli)
39
+ [![Production](https://img.shields.io/badge/Production-Live-brightgreen)](https://project-brain-web-gamma.vercel.app/)
40
+
41
+ ---
42
+
43
+ ## 🚀 What is project-brain?
44
+
45
+ `project-brain` is a CLI-first developer intelligence tool built for analyzing codebases, tracking Git changes at function level, generating structured exports for AI systems, and explaining code changes using optional LLM integrations.
46
+
47
+ Unlike traditional Git tooling that operates on raw line diffs, project-brain uses AST-based parsing to understand code structure and produce developer-friendly insights.
48
+
49
+ The project is designed around a **local-first**, **privacy-friendly**, and **AI-optional** workflow.
50
+
51
+ ---
52
+
53
+ # 🎯 Why project-brain Exists
54
+
55
+ Modern development workflows suffer from several problems:
56
+
57
+ ### Git diffs are noisy
58
+
59
+ Traditional diffs show line changes, not semantic meaning.
60
+
61
+ A small refactor can generate large diffs while hiding the actual behavioral impact.
62
+
63
+ ---
64
+
65
+ ### Codebases become difficult to understand
66
+
67
+ Large repositories contain:
68
+
69
+ * deeply nested modules
70
+ * duplicated logic
71
+ * unclear ownership
72
+ * hidden dependencies
73
+
74
+ Understanding them manually is slow.
75
+
76
+ ---
77
+
78
+ ### AI tools require structured context
79
+
80
+ Most AI systems perform poorly when fed raw repositories.
81
+
82
+ project-brain creates:
83
+
84
+ * structured exports
85
+ * focused change sets
86
+ * function-level intelligence
87
+ * AI-friendly context
88
+
89
+ ---
90
+
91
+ # ✨ Features
92
+
93
+ ## Implemented
94
+
95
+ * 🔍 Recursive repository scanning
96
+ * 🧠 AST-based Python analysis
97
+ * 🧩 Function extraction
98
+ * 🏛️ Class extraction
99
+ * 🔄 Git diff parsing
100
+ * 📌 Function-level change tracking
101
+ * 📦 AI-friendly code export system
102
+ * 🤖 Optional LLM explanations
103
+ * 💾 Explanation caching
104
+ * 🌐 HTML diff reports
105
+ * ⚠️ Config validation
106
+ * 🩺 Environment diagnostics
107
+ * 🪵 Persistent logging
108
+ * 🚫 Binary file skipping
109
+ * 🛡️ Invalid Python safety handling
110
+ * ⚡ Deep directory traversal
111
+
112
+ ---
113
+
114
+ # ⚙️ Installation
115
+ ## Requirements
116
+
117
+ * Python >= 3.10
118
+ * Git installed
119
+ * Optional:
120
+
121
+ * Ollama
122
+ * OpenAI API access
123
+ * Gemini API access
124
+ * HuggingFace API access
125
+
126
+ ---
127
+
128
+ ## Install from PyPI
129
+
130
+ ```bash
131
+ pip install project-brain-cli
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Verify Installation
137
+
138
+ ```bash
139
+ brain --version
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Upgrade
145
+
146
+ ```bash
147
+ pip install --upgrade project-brain-cli
148
+ ```
149
+ ---
150
+
151
+ ## CLI Aliases
152
+
153
+ Both commands work:
154
+
155
+ ```bash
156
+ brain
157
+ ```
158
+
159
+ ```bash
160
+ project-brain
161
+ ```
162
+
163
+ ---
164
+
165
+ # ⚡ Quick Start (30 Seconds), [For More INFO Click](https://project-brain-web-gamma.vercel.app/)
166
+
167
+ ---
168
+
169
+ ## 1. Initialize project-brain
170
+
171
+ ```bash
172
+ brain project init
173
+ ```
174
+ Demo:
175
+ ---
176
+ ![](demo/gifs/init.gif)
177
+ ---
178
+ Creates:
179
+
180
+ ```text
181
+ .brain/
182
+ brain.yaml
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 2. Analyze Repository
188
+
189
+ ```bash
190
+ brain project analyze .
191
+ ```
192
+ Demo:
193
+ ---
194
+ ![](demo/gifs/analyze.gif)
195
+ ---
196
+ Performs:
197
+
198
+ * recursive scan
199
+ * AST parsing
200
+ * metadata generation
201
+
202
+ Stores results inside:
203
+
204
+ ```text
205
+ .brain/data.json
206
+ ```
207
+
208
+ ---
209
+
210
+ ## 3. Inspect Git Changes
211
+
212
+ ```bash
213
+ brain diff show
214
+ ```
215
+ Demo:
216
+ ---
217
+ ![](demo/gifs/diff_show.gif)
218
+ ---
219
+ Default behavior:
220
+
221
+ ```text
222
+ HEAD~1 → HEAD
223
+ ```
224
+
225
+ Shows:
226
+
227
+ * modified files
228
+ * added files
229
+ * deleted files
230
+ * function-level changes
231
+
232
+ ---
233
+
234
+ ## 4. Export AI-Friendly Context
235
+
236
+ ```bash
237
+ brain export full-code
238
+ ```
239
+ Demo:
240
+ ---
241
+ ![](demo/gifs/export_full_code.gif)
242
+ ---
243
+ Creates:
244
+
245
+ ```text
246
+ .brain/exports/full_code.txt
247
+ ```
248
+ ---
249
+ ## 5. Diagnostics
250
+
251
+ Validate project readiness:
252
+
253
+ ```bash
254
+ brain project doctor
255
+ ```
256
+ Demo:
257
+ ---
258
+ ![](demo/gifs/doctor.gif)
259
+ ---
260
+ Checks:
261
+
262
+ - git availability
263
+ - project initialization
264
+ - analysis freshness
265
+ - export availability
266
+ - provider configuration
267
+ - API key presence
268
+
269
+ ---
270
+
271
+ ## 6. Access Community Resources
272
+
273
+ ```bash
274
+ brain community
275
+ ```
276
+ Demo:
277
+ ---
278
+ ![](demo/gifs/community.gif)
279
+ ---
280
+ Open feedback/discussions directly:
281
+
282
+ ```bash
283
+ brain --feedback
284
+ ```
285
+
286
+ ---
287
+
288
+ # 🧪 LLM Commands
289
+
290
+ ---
291
+
292
+ ## `brain testllm test`
293
+
294
+ Test provider connectivity.
295
+
296
+ ### Syntax
297
+
298
+ ```bash
299
+ brain testllm test
300
+ ```
301
+
302
+ ---
303
+
304
+ ### What It Does
305
+
306
+ * loads provider config
307
+ * sends test prompt
308
+ * validates response
309
+ * optionally fetches model list
310
+
311
+ ---
312
+
313
+ ### Disabled Mode
314
+
315
+ If:
316
+
317
+ ```yaml
318
+ provider: none
319
+ ```
320
+
321
+ Output:
322
+
323
+ ```text
324
+ LLM disabled
325
+ ```
326
+
327
+ ---
328
+
329
+ # ⚙️ Configuration
330
+
331
+ Configuration file:
332
+
333
+ ```text
334
+ brain.yaml
335
+ ```
336
+
337
+ ---
338
+
339
+ # Example Configuration
340
+
341
+ ```yaml id="g8r7wq"
342
+ version: "1.1.0"
343
+
344
+ llm:
345
+ provider: none
346
+ model: ""
347
+ timeout_sec: 60
348
+
349
+ analysis:
350
+ depth: fast
351
+ include_tests: false
352
+
353
+ ignore:
354
+ - .brain/
355
+ - .git/
356
+ - node_modules/
357
+ - venv/
358
+ - .venv/
359
+ - __pycache__/
360
+ - env/
361
+ - .env/
362
+ - project_brain_cli.egg-info/
363
+ - tests/
364
+ - test/
365
+
366
+ diff:
367
+ mode: function
368
+
369
+ export:
370
+ full_code:
371
+ include_tests: false
372
+ max_file_size_kb: 200
373
+
374
+ manual_add:
375
+ allow_duplicates: true
376
+
377
+ changes:
378
+ mode: function
379
+ include_context: true
380
+ output_path: .brain/exports/code_changes.txt
381
+
382
+ ignore:
383
+ - .brain/
384
+ - .git/
385
+ - node_modules/
386
+ - venv/
387
+ - .venv/
388
+ - __pycache__/
389
+ - env/
390
+ - .env/
391
+ - project_brain_cli.egg-info/
392
+ - tests/
393
+ - test/
394
+
395
+ explain:
396
+ level: detailed
397
+ include_risks: true
398
+
399
+ output:
400
+ format: text
401
+ ```
402
+
403
+ ---
404
+
405
+ # 🔑 API Key Setup
406
+
407
+ Secrets should NEVER be stored inside `brain.yaml`.
408
+
409
+ ---
410
+
411
+ ## Windows CMD
412
+
413
+ ```bash
414
+ setx OPENAI_API_KEY "your_key"
415
+ ```
416
+
417
+ ```bash
418
+ setx GEMINI_API_KEY "your_key"
419
+ ```
420
+
421
+ ```bash
422
+ setx HUGGINGFACE_API_KEY "your_key"
423
+ ```
424
+
425
+ ---
426
+
427
+ ## PowerShell
428
+
429
+ ```powershell
430
+ [Environment]::SetEnvironmentVariable("OPENAI_API_KEY","your_key","User")
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Linux/macOS
436
+
437
+ ```bash
438
+ export OPENAI_API_KEY="your_key"
439
+ ```
440
+
441
+ ---
442
+
443
+ # 📴 Offline Mode
444
+
445
+ project-brain fully supports offline workflows.
446
+
447
+ Use:
448
+
449
+ ```yaml
450
+ llm:
451
+ provider: none
452
+ ```
453
+
454
+ Behavior:
455
+
456
+ * no API calls
457
+ * no cloud dependency
458
+ * local-only analysis
459
+ * fallback explanations enabled
460
+
461
+ ---
462
+
463
+ # 📄 Example Outputs
464
+
465
+ ---
466
+
467
+ ## Analysis
468
+
469
+ ```text
470
+ 🔍 Analyzing: .
471
+
472
+ 📋 File Paths:
473
+ src/api.py
474
+ src/utils.py
475
+
476
+ ✅ Analysis complete
477
+ ```
478
+
479
+ ---
480
+
481
+ ## Diff Review
482
+
483
+ ```text
484
+ Function: create_user
485
+
486
+ Change:
487
+ Added validation layer
488
+
489
+ Impact:
490
+ Improves input integrity
491
+
492
+ Risk:
493
+ medium
494
+ ```
495
+
496
+ ---
497
+ # 🏗️ Architecture
498
+
499
+ ```text
500
+ CLI Layer
501
+
502
+ ├── Analyzer Engine
503
+ ├── Diff Engine
504
+ ├── Explain Engine
505
+ ├── Export Engine
506
+ ├── Diagnostics Layer
507
+ ├── Config Validation
508
+ ├── Logging System
509
+ └── LLM Provider Layer
510
+ ```
511
+
512
+ ---
513
+
514
+ # 🔄 Supported Providers
515
+
516
+ | Provider | Supported |
517
+ |---|---|
518
+ | OpenAI | ✅ |
519
+ | Ollama | ✅ |
520
+ | Gemini | ✅ |
521
+ | HuggingFace | ✅ |
522
+ | Offline Mode | ✅ |
523
+
524
+ ---
525
+
526
+ # 🪵 Logging System
527
+
528
+ Logs stored inside:
529
+
530
+ ```text
531
+ .brain/logs.txt
532
+ ```
533
+
534
+ Tracks:
535
+
536
+ * warnings
537
+ * provider failures
538
+ * parsing errors
539
+ * export failures
540
+ * cache issues
541
+
542
+ Logging failures never crash the CLI.
543
+
544
+ ---
545
+
546
+ # 🛠️ Troubleshooting
547
+
548
+ ---
549
+
550
+ ## ❌ Not a git repository
551
+
552
+ Initialize git:
553
+
554
+ ```bash
555
+ git init
556
+ ```
557
+
558
+ ---
559
+
560
+ ## ❌ Invalid git reference
561
+
562
+ Check refs:
563
+
564
+ ```bash
565
+ git log --oneline
566
+ ```
567
+
568
+ ---
569
+
570
+ ## ❌ Empty export
571
+
572
+ Possible causes:
573
+
574
+ * ignored paths
575
+ * file size limits
576
+ * tests excluded
577
+
578
+ ---
579
+
580
+ ## ❌ Provider failures
581
+
582
+ Check:
583
+
584
+ * API keys
585
+ * internet connectivity
586
+ * provider model name
587
+
588
+ ---
589
+
590
+ ## ❌ Missing API key
591
+
592
+ Verify environment variable:
593
+
594
+ ```bash
595
+ echo %OPENAI_API_KEY%
596
+ ```
597
+
598
+ ---
599
+
600
+ # 🧪 Testing & QA
601
+
602
+ Current QA status:
603
+
604
+ * 18 automated tests passing
605
+ * export validation
606
+ * function diff validation
607
+ * config validation
608
+ * edge-case handling
609
+ * provider fallback testing
610
+
611
+ ---
612
+ # 🔮 Roadmap
613
+
614
+ ## Near-Term
615
+
616
+ * semantic diff intelligence
617
+ * integration tests
618
+ * incremental analysis
619
+ * performance improvements
620
+ * rename detection
621
+
622
+ ---
623
+
624
+ ## Mid-Term
625
+
626
+ * multi-language parsing
627
+ * plugin architecture
628
+ * dependency graphing
629
+ * richer semantic indexing
630
+
631
+ ---
632
+
633
+ # 🔐 Security & Privacy
634
+
635
+ project-brain is designed with a local-first philosophy.
636
+
637
+ Key principles:
638
+
639
+ * no automatic code uploads
640
+ * offline workflows supported
641
+ * API keys via environment variables only
642
+ * repository data stored locally
643
+
644
+ LLM usage is fully optional.
645
+
646
+ ---
647
+
648
+ # 🤝 Contributing
649
+
650
+ Contributions are welcome.
651
+
652
+ Recommended workflow:
653
+
654
+ ```bash
655
+ git checkout -b feature/my-feature
656
+ ```
657
+
658
+ Guidelines:
659
+
660
+ * keep PRs focused
661
+ * preserve CLI consistency
662
+ * add tests for new logic
663
+ * avoid unnecessary dependencies
664
+
665
+ ---
666
+
667
+ # 📜 License
668
+
669
+ MIT License
670
+
671
+ ---
672
+
673
+ # 🧠 Final Positioning
674
+
675
+ > project-brain is a local-first developer intelligence CLI that transforms repositories and Git diffs into structured, explainable engineering context.