codeshield-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 (83) hide show
  1. codeshield_ai-0.1.0/.env.example +40 -0
  2. codeshield_ai-0.1.0/.github/workflows/workflow.yml +53 -0
  3. codeshield_ai-0.1.0/.gitignore +54 -0
  4. codeshield_ai-0.1.0/.leanmcpignore +10 -0
  5. codeshield_ai-0.1.0/Dockerfile +27 -0
  6. codeshield_ai-0.1.0/PKG-INFO +565 -0
  7. codeshield_ai-0.1.0/README.md +520 -0
  8. codeshield_ai-0.1.0/debug_comet.py +50 -0
  9. codeshield_ai-0.1.0/demo_full.py +145 -0
  10. codeshield_ai-0.1.0/demo_token_efficiency.py +182 -0
  11. codeshield_ai-0.1.0/examples/broken_code.py +41 -0
  12. codeshield_ai-0.1.0/examples/sample_codebase.py +56 -0
  13. codeshield_ai-0.1.0/frontend/.gitignore +25 -0
  14. codeshield_ai-0.1.0/frontend/.vercel/README.txt +11 -0
  15. codeshield_ai-0.1.0/frontend/.vercel/project.json +1 -0
  16. codeshield_ai-0.1.0/frontend/README.md +73 -0
  17. codeshield_ai-0.1.0/frontend/eslint.config.js +23 -0
  18. codeshield_ai-0.1.0/frontend/index.html +24 -0
  19. codeshield_ai-0.1.0/frontend/package-lock.json +3584 -0
  20. codeshield_ai-0.1.0/frontend/package.json +37 -0
  21. codeshield_ai-0.1.0/frontend/public/vite.svg +1 -0
  22. codeshield_ai-0.1.0/frontend/src/App.css +42 -0
  23. codeshield_ai-0.1.0/frontend/src/App.tsx +91 -0
  24. codeshield_ai-0.1.0/frontend/src/assets/react.svg +1 -0
  25. codeshield_ai-0.1.0/frontend/src/components/CodeEditor.tsx +110 -0
  26. codeshield_ai-0.1.0/frontend/src/components/Docs.tsx +1195 -0
  27. codeshield_ai-0.1.0/frontend/src/components/Hero.tsx +52 -0
  28. codeshield_ai-0.1.0/frontend/src/components/Logo.tsx +105 -0
  29. codeshield_ai-0.1.0/frontend/src/components/ReactiveCodeGraph.tsx +262 -0
  30. codeshield_ai-0.1.0/frontend/src/components/ResultsPanel.tsx +207 -0
  31. codeshield_ai-0.1.0/frontend/src/index.css +76 -0
  32. codeshield_ai-0.1.0/frontend/src/main.tsx +10 -0
  33. codeshield_ai-0.1.0/frontend/src/services/api.ts +188 -0
  34. codeshield_ai-0.1.0/frontend/tsconfig.app.json +28 -0
  35. codeshield_ai-0.1.0/frontend/tsconfig.json +7 -0
  36. codeshield_ai-0.1.0/frontend/tsconfig.node.json +26 -0
  37. codeshield_ai-0.1.0/frontend/vercel.json +9 -0
  38. codeshield_ai-0.1.0/frontend/vite.config.ts +8 -0
  39. codeshield_ai-0.1.0/leanmcp/.env.example +25 -0
  40. codeshield_ai-0.1.0/leanmcp/README.md +182 -0
  41. codeshield_ai-0.1.0/leanmcp/leanmcp.config.js +58 -0
  42. codeshield_ai-0.1.0/leanmcp/main.ts +94 -0
  43. codeshield_ai-0.1.0/leanmcp/mcp/contextvault/index.ts +180 -0
  44. codeshield_ai-0.1.0/leanmcp/mcp/health/index.ts +190 -0
  45. codeshield_ai-0.1.0/leanmcp/mcp/styleforge/index.ts +138 -0
  46. codeshield_ai-0.1.0/leanmcp/mcp/verification/index.ts +116 -0
  47. codeshield_ai-0.1.0/leanmcp/package-lock.json +2873 -0
  48. codeshield_ai-0.1.0/leanmcp/package.json +33 -0
  49. codeshield_ai-0.1.0/leanmcp/tsconfig.json +21 -0
  50. codeshield_ai-0.1.0/main.py +5 -0
  51. codeshield_ai-0.1.0/mcp_config.json +15 -0
  52. codeshield_ai-0.1.0/pyproject.toml +81 -0
  53. codeshield_ai-0.1.0/railway.toml +9 -0
  54. codeshield_ai-0.1.0/src/codeshield/__init__.py +62 -0
  55. codeshield_ai-0.1.0/src/codeshield/api_server.py +438 -0
  56. codeshield_ai-0.1.0/src/codeshield/cli.py +48 -0
  57. codeshield_ai-0.1.0/src/codeshield/contextvault/__init__.py +1 -0
  58. codeshield_ai-0.1.0/src/codeshield/contextvault/capture.py +174 -0
  59. codeshield_ai-0.1.0/src/codeshield/contextvault/restore.py +115 -0
  60. codeshield_ai-0.1.0/src/codeshield/mcp/__init__.py +1 -0
  61. codeshield_ai-0.1.0/src/codeshield/mcp/hooks.py +65 -0
  62. codeshield_ai-0.1.0/src/codeshield/mcp/server.py +319 -0
  63. codeshield_ai-0.1.0/src/codeshield/styleforge/__init__.py +1 -0
  64. codeshield_ai-0.1.0/src/codeshield/styleforge/corrector.py +298 -0
  65. codeshield_ai-0.1.0/src/codeshield/trustgate/__init__.py +1 -0
  66. codeshield_ai-0.1.0/src/codeshield/trustgate/checker.py +384 -0
  67. codeshield_ai-0.1.0/src/codeshield/trustgate/sandbox.py +101 -0
  68. codeshield_ai-0.1.0/src/codeshield/utils/__init__.py +9 -0
  69. codeshield_ai-0.1.0/src/codeshield/utils/daytona.py +233 -0
  70. codeshield_ai-0.1.0/src/codeshield/utils/leanmcp.py +258 -0
  71. codeshield_ai-0.1.0/src/codeshield/utils/llm.py +423 -0
  72. codeshield_ai-0.1.0/src/codeshield/utils/metrics.py +543 -0
  73. codeshield_ai-0.1.0/src/codeshield/utils/token_optimizer.py +605 -0
  74. codeshield_ai-0.1.0/test_all_features.py +165 -0
  75. codeshield_ai-0.1.0/test_api.py +68 -0
  76. codeshield_ai-0.1.0/test_daytona.py +42 -0
  77. codeshield_ai-0.1.0/test_quick.py +65 -0
  78. codeshield_ai-0.1.0/test_sandbox.py +57 -0
  79. codeshield_ai-0.1.0/tests/__init__.py +1 -0
  80. codeshield_ai-0.1.0/tests/test_comprehensive.py +688 -0
  81. codeshield_ai-0.1.0/tests/test_styleforge.py +67 -0
  82. codeshield_ai-0.1.0/tests/test_trustgate.py +129 -0
  83. codeshield_ai-0.1.0/verify_demo.py +59 -0
@@ -0,0 +1,40 @@
1
+ # ============================================
2
+ # CodeShield Environment Configuration
3
+ # ============================================
4
+ # Copy this file to .env and fill in your API keys
5
+ # ALL KEYS ARE REQUIRED for full functionality
6
+
7
+ # ============================================
8
+ # LLM Providers (Required - Fallback Chain)
9
+ # Order: CometAPI -> Novita -> AIML
10
+ # ============================================
11
+
12
+ # CometAPI - PRIMARY (Unified gateway to 100+ AI models)
13
+ # Get your key: https://api.cometapi.com/console/token
14
+ # Docs: https://apidoc.cometapi.com/
15
+ COMETAPI_KEY=sk-your_cometapi_key_here
16
+
17
+ # Novita.ai - SECONDARY (Cost-effective open-source inference)
18
+ # Get your key: https://novita.ai/settings/key-management
19
+ # Docs: https://novita.ai/docs/guides/llm-api
20
+ NOVITA_API_KEY=sk_your_novita_key_here
21
+
22
+ # AIML API - FALLBACK
23
+ AIML_API_KEY=your_aiml_key_here
24
+
25
+ # ============================================
26
+ # Infrastructure (Required)
27
+ # ============================================
28
+
29
+ # Daytona - Secure Sandbox Execution
30
+ # Get your key: https://app.daytona.io/
31
+ # Docs: https://www.daytona.io/docs
32
+ DAYTONA_API_KEY=dtn_your_daytona_key_here
33
+ DAYTONA_API_URL=https://app.daytona.io/api
34
+
35
+ # LeanMCP - MCP Server Observability & Deployment
36
+ # Get your key: https://leanmcp.com/
37
+ # Docs: https://docs.leanmcp.com/
38
+ LEANMCP_KEY=leanmcp_your_key_here
39
+ LEANMCP_API_URL=https://api.leanmcp.com
40
+
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ name: Build distribution
11
+ runs-on: ubuntu-latest
12
+
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/CodeShield
42
+ permissions:
43
+ id-token: write
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 to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,54 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual Environments
25
+ .env
26
+ .venv
27
+ env/
28
+ venv/
29
+ ENV/
30
+ env.bak/
31
+ venv.bak/
32
+
33
+ # Node
34
+ node_modules/
35
+ frontend/node_modules/
36
+ frontend/dist/
37
+ npm-debug.log*
38
+ yarn-debug.log*
39
+ yarn-error.log*
40
+
41
+ # IDE
42
+ .vscode/
43
+ .idea/
44
+ *.swp
45
+ *.swo
46
+
47
+ # LeanMCP
48
+ .leanmcp/
49
+
50
+ # Daytona
51
+ .daytona/
52
+
53
+ # CodeShield
54
+ *.db
@@ -0,0 +1,10 @@
1
+ **/node_modules
2
+ **/venv
3
+ **/.venv
4
+ **/__pycache__
5
+ **/.git
6
+ **/*.pyc
7
+ **/*.pyo
8
+ **/*.pyd
9
+ .env
10
+
@@ -0,0 +1,27 @@
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy project files
6
+ COPY pyproject.toml .
7
+ COPY src/ src/
8
+ COPY README.md .
9
+
10
+ # Install dependencies and the package
11
+ RUN pip install --no-cache-dir .
12
+
13
+ # Expose port if needed (MCP usually uses stdio or SSE on a port)
14
+ # LeanMCP might expect an HTTP server for SSE.
15
+ # The FastMCP server by default uses stdio, but can run SSE.
16
+ # We'll explicitly run it.
17
+ # Note: server.py main block invokes run() which does stdio.
18
+ # We might need to adjust for SSE if deploying as a service.
19
+
20
+ # Env var for unbuffered output
21
+ ENV PYTHONUNBUFFERED=1
22
+
23
+ # Default port
24
+ ENV PORT=8000
25
+
26
+ # Default command: FastAPI HTTP server for cloud deployment
27
+ CMD uvicorn codeshield.api_server:app --host 0.0.0.0 --port $PORT