codeprism-ai 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 (78) hide show
  1. codeprism_ai-0.1.0/.github/workflows/publish.yml +53 -0
  2. codeprism_ai-0.1.0/.gitignore +222 -0
  3. codeprism_ai-0.1.0/CODE_OF_CONDUCT.md +98 -0
  4. codeprism_ai-0.1.0/CONTRIBUTING.md +380 -0
  5. codeprism_ai-0.1.0/LICENSE +21 -0
  6. codeprism_ai-0.1.0/PKG-INFO +445 -0
  7. codeprism_ai-0.1.0/README.md +396 -0
  8. codeprism_ai-0.1.0/codeprism/__init__.py +184 -0
  9. codeprism_ai-0.1.0/codeprism/cli.py +662 -0
  10. codeprism_ai-0.1.0/codeprism/core/__init__.py +40 -0
  11. codeprism_ai-0.1.0/codeprism/core/config.py +58 -0
  12. codeprism_ai-0.1.0/codeprism/core/graph.py +288 -0
  13. codeprism_ai-0.1.0/codeprism/core/models.py +189 -0
  14. codeprism_ai-0.1.0/codeprism/core/paths.py +33 -0
  15. codeprism_ai-0.1.0/codeprism/core/storage.py +464 -0
  16. codeprism_ai-0.1.0/codeprism/embeddings/__init__.py +9 -0
  17. codeprism_ai-0.1.0/codeprism/embeddings/embedder.py +45 -0
  18. codeprism_ai-0.1.0/codeprism/embeddings/store.py +105 -0
  19. codeprism_ai-0.1.0/codeprism/indexer/__init__.py +13 -0
  20. codeprism_ai-0.1.0/codeprism/indexer/incremental_updater.py +138 -0
  21. codeprism_ai-0.1.0/codeprism/indexer/project_indexer.py +181 -0
  22. codeprism_ai-0.1.0/codeprism/indexer/watcher.py +131 -0
  23. codeprism_ai-0.1.0/codeprism/mcp/__init__.py +14 -0
  24. codeprism_ai-0.1.0/codeprism/mcp/server.py +442 -0
  25. codeprism_ai-0.1.0/codeprism/mcp/session.py +212 -0
  26. codeprism_ai-0.1.0/codeprism/mcp/tools.py +136 -0
  27. codeprism_ai-0.1.0/codeprism/parser/__init__.py +18 -0
  28. codeprism_ai-0.1.0/codeprism/parser/base.py +53 -0
  29. codeprism_ai-0.1.0/codeprism/parser/generic_parser.py +47 -0
  30. codeprism_ai-0.1.0/codeprism/parser/go_parser.py +303 -0
  31. codeprism_ai-0.1.0/codeprism/parser/javascript_parser.py +514 -0
  32. codeprism_ai-0.1.0/codeprism/parser/python_parser.py +425 -0
  33. codeprism_ai-0.1.0/codeprism/parser/registry.py +75 -0
  34. codeprism_ai-0.1.0/codeprism/query/__init__.py +30 -0
  35. codeprism_ai-0.1.0/codeprism/query/context.py +78 -0
  36. codeprism_ai-0.1.0/codeprism/query/engine.py +278 -0
  37. codeprism_ai-0.1.0/codeprism/query/impact.py +90 -0
  38. codeprism_ai-0.1.0/codeprism/query/summary.py +110 -0
  39. codeprism_ai-0.1.0/codeprism/security/__init__.py +32 -0
  40. codeprism_ai-0.1.0/codeprism/security/cve.py +93 -0
  41. codeprism_ai-0.1.0/codeprism/security/detectors/__init__.py +20 -0
  42. codeprism_ai-0.1.0/codeprism/security/detectors/base.py +61 -0
  43. codeprism_ai-0.1.0/codeprism/security/detectors/crypto.py +53 -0
  44. codeprism_ai-0.1.0/codeprism/security/detectors/dependencies.py +47 -0
  45. codeprism_ai-0.1.0/codeprism/security/detectors/env_vars.py +47 -0
  46. codeprism_ai-0.1.0/codeprism/security/detectors/git_safety.py +70 -0
  47. codeprism_ai-0.1.0/codeprism/security/detectors/injection.py +62 -0
  48. codeprism_ai-0.1.0/codeprism/security/detectors/secrets.py +68 -0
  49. codeprism_ai-0.1.0/codeprism/security/gate.py +57 -0
  50. codeprism_ai-0.1.0/codeprism/security/rules/__init__.py +1 -0
  51. codeprism_ai-0.1.0/codeprism/security/rules/common_rules.json +69 -0
  52. codeprism_ai-0.1.0/codeprism/security/rules/python_rules.json +114 -0
  53. codeprism_ai-0.1.0/codeprism/security/scanner.py +124 -0
  54. codeprism_ai-0.1.0/pyproject.toml +103 -0
  55. codeprism_ai-0.1.0/tests/__init__.py +0 -0
  56. codeprism_ai-0.1.0/tests/conftest.py +78 -0
  57. codeprism_ai-0.1.0/tests/fixtures/sample_js_project/service.js +29 -0
  58. codeprism_ai-0.1.0/tests/fixtures/sample_js_project/utils.ts +22 -0
  59. codeprism_ai-0.1.0/tests/fixtures/sample_python_project/main.py +16 -0
  60. codeprism_ai-0.1.0/tests/fixtures/sample_python_project/processor.py +39 -0
  61. codeprism_ai-0.1.0/tests/fixtures/sample_security_issues/clean_example.py +17 -0
  62. codeprism_ai-0.1.0/tests/fixtures/sample_security_issues/crypto_example.py +16 -0
  63. codeprism_ai-0.1.0/tests/fixtures/sample_security_issues/injection_example.py +20 -0
  64. codeprism_ai-0.1.0/tests/fixtures/sample_security_issues/secrets_example.py +10 -0
  65. codeprism_ai-0.1.0/tests/test_cli.py +287 -0
  66. codeprism_ai-0.1.0/tests/test_facade.py +124 -0
  67. codeprism_ai-0.1.0/tests/test_graph_engine.py +309 -0
  68. codeprism_ai-0.1.0/tests/test_impact_analysis.py +193 -0
  69. codeprism_ai-0.1.0/tests/test_incremental_updater.py +167 -0
  70. codeprism_ai-0.1.0/tests/test_indexer.py +219 -0
  71. codeprism_ai-0.1.0/tests/test_mcp_server.py +377 -0
  72. codeprism_ai-0.1.0/tests/test_parser_javascript.py +243 -0
  73. codeprism_ai-0.1.0/tests/test_parser_python.py +311 -0
  74. codeprism_ai-0.1.0/tests/test_query_engine.py +180 -0
  75. codeprism_ai-0.1.0/tests/test_security_detectors.py +282 -0
  76. codeprism_ai-0.1.0/tests/test_security_gate.py +226 -0
  77. codeprism_ai-0.1.0/tests/test_session.py +255 -0
  78. codeprism_ai-0.1.0/tests/test_storage.py +193 -0
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install build dependencies
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Store the distribution packages
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ publish-to-pypi:
36
+ name: Publish to PyPI
37
+ needs: build
38
+ runs-on: ubuntu-latest
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/p/codeprism
42
+ permissions:
43
+ id-token: write # IMPORTANT: mandatory for trusted publishing
44
+
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+
52
+ - name: Publish distribution to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,222 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+
221
+
222
+ CODEPRISM_SPEC.md
@@ -0,0 +1,98 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in the CodePrism community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ---
10
+
11
+ ## Our Standards
12
+
13
+ **Examples of behavior that contributes to a positive environment:**
14
+
15
+ - Using welcoming and inclusive language
16
+ - Being respectful of differing viewpoints and experiences
17
+ - Gracefully accepting constructive criticism
18
+ - Focusing on what is best for the community
19
+ - Showing empathy towards other community members
20
+ - Giving credit where it is due — acknowledging others' contributions
21
+ - Supporting newcomers and helping them ramp up
22
+
23
+ **Examples of unacceptable behavior:**
24
+
25
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
26
+ - Trolling, insulting or derogatory comments, and personal or political attacks
27
+ - Public or private harassment
28
+ - Publishing others' private information (physical or email addresses) without explicit permission
29
+ - Deliberately misrepresenting others' contributions or ideas
30
+ - Sustained disruption of community discussions, talks, or events
31
+ - Dismissing or belittling others' questions — no question is too basic
32
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
33
+
34
+ ---
35
+
36
+ ## Enforcement Responsibilities
37
+
38
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
39
+
40
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
41
+
42
+ ---
43
+
44
+ ## Scope
45
+
46
+ This Code of Conduct applies within all community spaces — including the GitHub repository, issue tracker, pull requests, discussions, and any other official CodePrism communication channels.
47
+
48
+ It also applies when an individual is officially representing the community in public spaces. Examples include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
49
+
50
+ ---
51
+
52
+ ## Enforcement
53
+
54
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at:
55
+
56
+ **krishna.tyagi@futuresmart.ai**
57
+
58
+ All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident.
59
+
60
+ ---
61
+
62
+ ## Enforcement Guidelines
63
+
64
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
65
+
66
+ ### 1. Correction
67
+
68
+ **Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
69
+
70
+ **Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
71
+
72
+ ### 2. Warning
73
+
74
+ **Community Impact:** A violation through a single incident or series of actions.
75
+
76
+ **Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
77
+
78
+ ### 3. Temporary Ban
79
+
80
+ **Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.
81
+
82
+ **Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
83
+
84
+ ### 4. Permanent Ban
85
+
86
+ **Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
87
+
88
+ **Consequence:** A permanent ban from any sort of public interaction within the community.
89
+
90
+ ---
91
+
92
+ ## Attribution
93
+
94
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
95
+
96
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
97
+
98
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq).