xenfra 0.4.3__tar.gz → 0.4.5__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 (30) hide show
  1. xenfra-0.4.5/PKG-INFO +113 -0
  2. xenfra-0.4.5/README.md +78 -0
  3. {xenfra-0.4.3 → xenfra-0.4.5}/pyproject.toml +54 -56
  4. xenfra-0.4.5/src/xenfra/blueprints/__init__.py +55 -0
  5. xenfra-0.4.5/src/xenfra/blueprints/base.py +85 -0
  6. xenfra-0.4.5/src/xenfra/blueprints/cache.py +286 -0
  7. xenfra-0.4.5/src/xenfra/blueprints/dry_run.py +251 -0
  8. xenfra-0.4.5/src/xenfra/blueprints/e2b.py +101 -0
  9. xenfra-0.4.5/src/xenfra/blueprints/factory.py +113 -0
  10. xenfra-0.4.5/src/xenfra/blueprints/railpack.py +319 -0
  11. xenfra-0.4.5/src/xenfra/blueprints/validation.py +182 -0
  12. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/__init__.py +3 -3
  13. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/auth.py +144 -144
  14. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/auth_device.py +164 -164
  15. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/deployments.py +1358 -973
  16. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/intelligence.py +503 -412
  17. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/projects.py +204 -204
  18. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/commands/security_cmd.py +233 -233
  19. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/main.py +79 -75
  20. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/__init__.py +3 -3
  21. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/auth.py +374 -374
  22. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/codebase.py +169 -169
  23. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/config.py +459 -436
  24. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/errors.py +116 -116
  25. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/file_sync.py +286 -286
  26. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/security.py +336 -336
  27. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/utils/validation.py +234 -234
  28. xenfra-0.4.3/PKG-INFO +0 -118
  29. xenfra-0.4.3/README.md +0 -83
  30. {xenfra-0.4.3 → xenfra-0.4.5}/src/xenfra/__init__.py +0 -0
xenfra-0.4.5/PKG-INFO ADDED
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.3
2
+ Name: xenfra
3
+ Version: 0.4.5
4
+ Summary: Xenfra CLI: Hands for AI to deploy on DigitalOcean.
5
+ Author: xenfra-cloud
6
+ Author-email: xenfra-cloud <xenfracloud@gmail.com>
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Classifier: Topic :: System :: Systems Administration
14
+ Requires-Dist: click>=8.1.7
15
+ Requires-Dist: rich>=14.2.0
16
+ Requires-Dist: sqlmodel>=0.0.16
17
+ Requires-Dist: python-digitalocean>=1.17.0
18
+ Requires-Dist: python-dotenv>=1.2.1
19
+ Requires-Dist: pyyaml>=6.0.1
20
+ Requires-Dist: fabric>=3.2.2
21
+ Requires-Dist: xenfra-sdk>=0.2.2
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: keyring>=25.7.0
24
+ Requires-Dist: keyrings-alt>=5.0.2
25
+ Requires-Dist: tenacity>=8.2.3
26
+ Requires-Dist: cryptography>=43.0.0
27
+ Requires-Dist: toml>=0.10.2
28
+ Requires-Dist: pytest>=8.0.0 ; extra == 'test'
29
+ Requires-Dist: pytest-mock>=3.12.0 ; extra == 'test'
30
+ Requires-Python: >=3.11
31
+ Project-URL: Homepage, https://github.com/xenfra-cloud/xenfra-cli
32
+ Project-URL: Issues, https://github.com/xenfra-cloud/xenfra-cli/issues
33
+ Provides-Extra: test
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Xenfra CLI (The Interface) 🖥️
37
+
38
+ [![PyPI](https://img.shields.io/pypi/v/xenfra)](https://pypi.org/project/xenfra/)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
40
+
41
+ The official command-line interface for **Xenfra** (The Sovereign Cloud OS). It empowers developers to deploy, monitor, and manage applications on their own infrastructure (DigitalOcean) with the ease of Heroku.
42
+
43
+ ## 🚀 Features
44
+
45
+ - **Zero-Config Deployment**: `xenfra deploy` detects your stack (Python, Node.js) and ships it.
46
+ - **Sovereign Auth**: `xenfra auth login` connects securely to your cloud provider.
47
+ - **Live Logs**: `xenfra logs` streams colorized, PII-scrubbed logs from your servers.
48
+ - **Doctor**: `xenfra doctor` runs a battery of health checks on your deployment environment.
49
+ - **Zen Mode**: Automatically applies fix patches when deployments fail.
50
+
51
+ ## 📦 Installation
52
+
53
+ ```bash
54
+ # Recommended: Install via uv
55
+ uv tool install xenfra
56
+
57
+ # Or via pip
58
+ pip install xenfra
59
+ ```
60
+
61
+ ## 🛠️ Quick Start
62
+
63
+ ### 1. Login
64
+
65
+ Authenticate with your cloud provider (DigitalOcean via Xenfra Platform).
66
+
67
+ ```bash
68
+ xenfra auth login
69
+ ```
70
+
71
+ ### 2. Deploy Your App
72
+
73
+ Navigate to your project directory and blast off.
74
+
75
+ ```bash
76
+ cd ~/my-projects/awesome-api
77
+ xenfra deploy
78
+ ```
79
+
80
+ _That's it._ Xenfra handles Dockerfile generation, server provisioning, SSL (Caddy), and database connections.
81
+
82
+ ### 3. Check Status
83
+
84
+ ```bash
85
+ xenfra status
86
+ ```
87
+
88
+ ## 🎛️ Command Reference
89
+
90
+ | Command | Description |
91
+ | :------------------ | :-------------------------------------- |
92
+ | `xenfra auth login` | Start the OAuth flow |
93
+ | `xenfra deploy` | Deploy current directory |
94
+ | `xenfra logs` | Tail logs (Ctrl+C to stop) |
95
+ | `xenfra status` | Show health metrics (CPU/RAM) |
96
+ | `xenfra list` | List all your projects |
97
+ | `xenfra init` | Generate config files without deploying |
98
+
99
+ ## 🔗 The Xenfra Ecosystem
100
+
101
+ This CLI is the "Interface" of the Xenfra Open Core architecture:
102
+
103
+ - **[xenfra-sdk](https://github.com/xenfracloud/xenfra-sdk)**: The Core Engine (Used by this CLI).
104
+ - **[xenfra-mcp](https://github.com/xenfracloud/xenfra-mcp)**: The AI Agent Interface.
105
+ - **xenfra-platform**: The Private SaaS Backend.
106
+
107
+ ## 🤝 Contributing
108
+
109
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
110
+
111
+ ## 📄 License
112
+
113
+ MIT © [Xenfra Cloud](https://xenfra.tech)
xenfra-0.4.5/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Xenfra CLI (The Interface) 🖥️
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/xenfra)](https://pypi.org/project/xenfra/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ The official command-line interface for **Xenfra** (The Sovereign Cloud OS). It empowers developers to deploy, monitor, and manage applications on their own infrastructure (DigitalOcean) with the ease of Heroku.
7
+
8
+ ## 🚀 Features
9
+
10
+ - **Zero-Config Deployment**: `xenfra deploy` detects your stack (Python, Node.js) and ships it.
11
+ - **Sovereign Auth**: `xenfra auth login` connects securely to your cloud provider.
12
+ - **Live Logs**: `xenfra logs` streams colorized, PII-scrubbed logs from your servers.
13
+ - **Doctor**: `xenfra doctor` runs a battery of health checks on your deployment environment.
14
+ - **Zen Mode**: Automatically applies fix patches when deployments fail.
15
+
16
+ ## 📦 Installation
17
+
18
+ ```bash
19
+ # Recommended: Install via uv
20
+ uv tool install xenfra
21
+
22
+ # Or via pip
23
+ pip install xenfra
24
+ ```
25
+
26
+ ## 🛠️ Quick Start
27
+
28
+ ### 1. Login
29
+
30
+ Authenticate with your cloud provider (DigitalOcean via Xenfra Platform).
31
+
32
+ ```bash
33
+ xenfra auth login
34
+ ```
35
+
36
+ ### 2. Deploy Your App
37
+
38
+ Navigate to your project directory and blast off.
39
+
40
+ ```bash
41
+ cd ~/my-projects/awesome-api
42
+ xenfra deploy
43
+ ```
44
+
45
+ _That's it._ Xenfra handles Dockerfile generation, server provisioning, SSL (Caddy), and database connections.
46
+
47
+ ### 3. Check Status
48
+
49
+ ```bash
50
+ xenfra status
51
+ ```
52
+
53
+ ## 🎛️ Command Reference
54
+
55
+ | Command | Description |
56
+ | :------------------ | :-------------------------------------- |
57
+ | `xenfra auth login` | Start the OAuth flow |
58
+ | `xenfra deploy` | Deploy current directory |
59
+ | `xenfra logs` | Tail logs (Ctrl+C to stop) |
60
+ | `xenfra status` | Show health metrics (CPU/RAM) |
61
+ | `xenfra list` | List all your projects |
62
+ | `xenfra init` | Generate config files without deploying |
63
+
64
+ ## 🔗 The Xenfra Ecosystem
65
+
66
+ This CLI is the "Interface" of the Xenfra Open Core architecture:
67
+
68
+ - **[xenfra-sdk](https://github.com/xenfracloud/xenfra-sdk)**: The Core Engine (Used by this CLI).
69
+ - **[xenfra-mcp](https://github.com/xenfracloud/xenfra-mcp)**: The AI Agent Interface.
70
+ - **xenfra-platform**: The Private SaaS Backend.
71
+
72
+ ## 🤝 Contributing
73
+
74
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
75
+
76
+ ## 📄 License
77
+
78
+ MIT © [Xenfra Cloud](https://xenfra.tech)
@@ -1,56 +1,54 @@
1
- [project]
2
- name = "xenfra"
3
- version = "0.4.3"
4
- description = "A 'Zen Mode' infrastructure engine for Python developers."
5
- readme = "README.md"
6
- authors = [
7
- { name = "xenfra-cloud", email = "xenfracloud@gmail.com" }
8
- ]
9
-
10
- classifiers = [
11
- "Programming Language :: Python :: 3",
12
- "License :: OSI Approved :: MIT License",
13
- "Operating System :: OS Independent",
14
- "Development Status :: 3 - Alpha",
15
- "Intended Audience :: Developers",
16
- "Topic :: Software Development :: Build Tools",
17
- "Topic :: System :: Systems Administration",
18
- ]
19
-
20
- dependencies = [
21
- "click>=8.1.7",
22
- "rich>=14.2.0",
23
- "sqlmodel>=0.0.16",
24
- "python-digitalocean>=1.17.0",
25
- "python-dotenv>=1.2.1",
26
- "pyyaml>=6.0.1",
27
- "fabric>=3.2.2",
28
- "xenfra-sdk",
29
- "httpx>=0.27.0",
30
- "keyring>=25.7.0",
31
- "keyrings.alt>=5.0.2",
32
- "tenacity>=8.2.3", # For retry logic
33
- "cryptography>=43.0.0", # For encrypted file-based token storage
34
- "toml>=0.10.2",
35
- ]
36
- requires-python = ">=3.13"
37
-
38
- [tool.uv.sources]
39
- xenfra-sdk = { workspace = true }
40
-
41
- [project.urls]
42
- Homepage = "https://github.com/xenfra-cloud/xenfra"
43
- Issues = "https://github.com/xenfra-cloud/xenfra/issues"
44
-
45
- [project.optional-dependencies]
46
- test = [
47
- "pytest>=8.0.0",
48
- "pytest-mock>=3.12.0",
49
- ]
50
-
51
- [project.scripts]
52
- xenfra = "xenfra.main:main"
53
-
54
- [build-system]
55
- requires = ["uv_build>=0.9.18,<0.10.0"]
56
- build-backend = "uv_build"
1
+ [project]
2
+ name = "xenfra"
3
+ version = "0.4.5"
4
+ description = "Xenfra CLI: Hands for AI to deploy on DigitalOcean."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "xenfra-cloud", email = "xenfracloud@gmail.com" }
8
+ ]
9
+
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Software Development :: Build Tools",
17
+ "Topic :: System :: Systems Administration",
18
+ ]
19
+
20
+ requires-python = ">=3.11"
21
+
22
+ dependencies = [
23
+ "click>=8.1.7",
24
+ "rich>=14.2.0",
25
+ "sqlmodel>=0.0.16",
26
+ "python-digitalocean>=1.17.0",
27
+ "python-dotenv>=1.2.1",
28
+ "pyyaml>=6.0.1",
29
+ "fabric>=3.2.2",
30
+ "xenfra-sdk>=0.2.2",
31
+ "httpx>=0.27.0",
32
+ "keyring>=25.7.0",
33
+ "keyrings.alt>=5.0.2",
34
+ "tenacity>=8.2.3", # For retry logic
35
+ "cryptography>=43.0.0", # For encrypted file-based token storage
36
+ "toml>=0.10.2",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ test = [
41
+ "pytest>=8.0.0",
42
+ "pytest-mock>=3.12.0",
43
+ ]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/xenfra-cloud/xenfra-cli"
47
+ Issues = "https://github.com/xenfra-cloud/xenfra-cli/issues"
48
+
49
+ [project.scripts]
50
+ xenfra = "xenfra.main:main"
51
+
52
+ [build-system]
53
+ requires = ["uv_build>=0.9.18,<0.10.0"]
54
+ build-backend = "uv_build"
@@ -0,0 +1,55 @@
1
+ """
2
+ Blueprint factory for framework detection and build plan generation.
3
+
4
+ Implements Railpack-first routing with 3-tier dry-run validation:
5
+ - Tier 1: Local validation (~100ms) - Syntax, imports, config
6
+ - Tier 2: Railpack plan (~1-2s) - Build plan generation
7
+ - Tier 3: E2B Sandbox (~30-60s) - Full build validation via Xenfra API
8
+
9
+ Tier 3 runs on Xenfra's servers - users don't need E2B installed.
10
+
11
+ Environment Variables:
12
+ - XENFRA_AI=off: Disable all AI features
13
+ - XENFRA_SANDBOX=force: Always run Tier 3 validation
14
+ - XENFRA_SANDBOX=skip: Skip Tier 3 validation
15
+ - XENFRA_SANDBOX=auto: Smart detection (default)
16
+ """
17
+
18
+ from .base import Blueprint, BuildPlan
19
+ from .factory import BlueprintFactory, get_factory, detect_project
20
+ from .railpack import RailpackBlueprint
21
+ from .dry_run import (
22
+ DryRunEngine,
23
+ DryRunResult,
24
+ run_dry_run,
25
+ quick_validate,
26
+ )
27
+ from .validation import ValidationResult, validate_project
28
+ from .e2b import E2BSandbox, SandboxResult, get_sandbox
29
+
30
+ __all__ = [
31
+ # Base classes
32
+ "Blueprint",
33
+ "BuildPlan",
34
+
35
+ # Factory
36
+ "BlueprintFactory",
37
+ "get_factory",
38
+ "detect_project",
39
+ "RailpackBlueprint",
40
+
41
+ # 3-Tier Dry Run
42
+ "DryRunEngine",
43
+ "DryRunResult",
44
+ "run_dry_run",
45
+ "quick_validate",
46
+
47
+ # Tier 1
48
+ "ValidationResult",
49
+ "validate_project",
50
+
51
+ # Tier 3
52
+ "E2BSandbox",
53
+ "SandboxResult",
54
+ "get_sandbox",
55
+ ]
@@ -0,0 +1,85 @@
1
+ """
2
+ Base blueprint interface for build plan generation.
3
+ """
4
+
5
+ from abc import ABC, abstractmethod
6
+ from dataclasses import dataclass, field
7
+ from typing import Optional
8
+ from pathlib import Path
9
+
10
+
11
+ @dataclass
12
+ class BuildPlan:
13
+ """A build plan containing all information needed to build and deploy."""
14
+
15
+ framework: str
16
+ language: str
17
+ package_manager: str
18
+ dependency_file: str
19
+ build_command: Optional[str] = None
20
+ start_command: Optional[str] = None
21
+ port: int = 8000
22
+ dockerfile: Optional[str] = None
23
+ env_vars: dict = field(default_factory=dict)
24
+ detected_from: str = "unknown" # How the framework was detected
25
+
26
+ def to_dict(self) -> dict:
27
+ """Convert build plan to dictionary."""
28
+ return {
29
+ "framework": self.framework,
30
+ "language": self.language,
31
+ "package_manager": self.package_manager,
32
+ "dependency_file": self.dependency_file,
33
+ "build_command": self.build_command,
34
+ "start_command": self.start_command,
35
+ "port": self.port,
36
+ "dockerfile": self.dockerfile,
37
+ "env_vars": self.env_vars,
38
+ "detected_from": self.detected_from,
39
+ }
40
+
41
+
42
+ class Blueprint(ABC):
43
+ """
44
+ Abstract base class for deployment blueprints.
45
+
46
+ Blueprints analyze project structure and generate build plans.
47
+ """
48
+
49
+ name: str = "base"
50
+ languages: list[str] = []
51
+
52
+ @abstractmethod
53
+ def detect(self, project_path: Path) -> bool:
54
+ """
55
+ Detect if this blueprint applies to the given project.
56
+
57
+ Args:
58
+ project_path: Path to the project directory
59
+
60
+ Returns:
61
+ True if this blueprint can handle the project
62
+ """
63
+ pass
64
+
65
+ @abstractmethod
66
+ def generate_plan(self, project_path: Path) -> BuildPlan:
67
+ """
68
+ Generate a build plan for the project.
69
+
70
+ Args:
71
+ project_path: Path to the project directory
72
+
73
+ Returns:
74
+ BuildPlan with all build/deployment information
75
+ """
76
+ pass
77
+
78
+ def get_priority(self) -> int:
79
+ """
80
+ Get the priority of this blueprint (higher = tried first).
81
+
82
+ Returns:
83
+ Priority integer
84
+ """
85
+ return 100