sprout-cli 0.2.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.
@@ -0,0 +1,145 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
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
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # IPython
79
+ profile_default/
80
+ ipython_config.py
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # pipenv
86
+ Pipfile.lock
87
+
88
+ # uv
89
+ .venv/
90
+ uv.lock
91
+
92
+ # PEP 582
93
+ __pypackages__/
94
+
95
+ # Celery stuff
96
+ celerybeat-schedule
97
+ celerybeat.pid
98
+
99
+ # SageMath parsed files
100
+ *.sage.py
101
+
102
+ # Environments
103
+ .env
104
+ .venv
105
+ env/
106
+ venv/
107
+ ENV/
108
+ env.bak/
109
+ venv.bak/
110
+
111
+ # Spyder project settings
112
+ .spyderproject
113
+ .spyproject
114
+
115
+ # Rope project settings
116
+ .ropeproject
117
+
118
+ # mkdocs documentation
119
+ /site
120
+
121
+ # mypy
122
+ .mypy_cache/
123
+ .dmypy.json
124
+ dmypy.json
125
+
126
+ # Pyre type checker
127
+ .pyre/
128
+
129
+ # IDEs
130
+ .vscode/
131
+ .idea/
132
+ *.swp
133
+ *.swo
134
+ *~
135
+
136
+ # OS
137
+ .DS_Store
138
+ Thumbs.db
139
+
140
+ # sprout specific
141
+ .sprout/
142
+ tmp/
143
+
144
+ # Claude Code specific
145
+ .claude/settings.local.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SecDevLab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: sprout-cli
3
+ Version: 0.2.0
4
+ Summary: CLI tool to automate git worktree and Docker Compose development workflows
5
+ Author: SecDevLab Inc.
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Classifier: Topic :: Software Development :: Version Control :: Git
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: rich>=13.0.0
19
+ Requires-Dist: typer>=0.9.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: mypy>=1.5.0; extra == 'dev'
22
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
23
+ Requires-Dist: pytest-mock>=3.0; extra == 'dev'
24
+ Requires-Dist: pytest>=7.0; extra == 'dev'
25
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
26
+ Requires-Dist: types-setuptools>=68.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # sprout
30
+
31
+ A CLI tool to automate git worktree and Docker Compose development workflows.
32
+
33
+ ## Features
34
+
35
+ - 🌱 Create isolated development environments using git worktrees
36
+ - 🔧 Automatic `.env` file generation from templates
37
+ - 🚢 Smart port allocation to avoid conflicts
38
+ - 📁 Centralized worktree management in `.sprout/` directory
39
+ - 🎨 Beautiful CLI interface with colors and tables
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install sprout
45
+ ```
46
+
47
+ For development:
48
+ ```bash
49
+ # Clone the repository
50
+ git clone https://github.com/SecDev-Lab/sprout.git
51
+ cd sprout
52
+
53
+ # Install in development mode
54
+ pip install -e ".[dev]"
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ 1. Create a `.env.example` template in your project root:
60
+ ```env
61
+ # API Configuration
62
+ API_KEY={{ API_KEY }}
63
+ API_PORT={{ auto_port() }}
64
+
65
+ # Database Configuration
66
+ DB_HOST=localhost
67
+ DB_PORT={{ auto_port() }}
68
+
69
+ # Example: Docker Compose variables (preserved as-is)
70
+ # sprout will NOT process ${...} syntax - it's passed through unchanged
71
+ # DB_NAME=${DB_NAME}
72
+ ```
73
+
74
+ 2. Create a new development environment:
75
+ ```bash
76
+ sprout create feature-branch
77
+ ```
78
+
79
+ 3. Navigate to your new environment:
80
+ ```bash
81
+ cd $(sprout path feature-branch)
82
+ ```
83
+
84
+ 4. Start your services:
85
+ ```bash
86
+ docker compose up -d
87
+ ```
88
+
89
+ ## Commands
90
+
91
+ ### `sprout create <branch-name>`
92
+ Create a new development environment with automated setup.
93
+
94
+ ### `sprout ls`
95
+ List all managed development environments with their status.
96
+
97
+ ### `sprout rm <branch-name>`
98
+ Remove a development environment (with confirmation prompts).
99
+
100
+ ### `sprout path <branch-name>`
101
+ Get the filesystem path of a development environment.
102
+
103
+ ### `sprout --version`
104
+ Show the version of sprout.
105
+
106
+ ## Template Syntax
107
+
108
+ sprout supports two types of placeholders in `.env.example`:
109
+
110
+ 1. **Variable Placeholders**: `{{ VARIABLE_NAME }}`
111
+ - **First**: Checks if the variable exists in your environment (e.g., `export API_KEY=xxx`)
112
+ - **Then**: If not found in environment, prompts for user input
113
+ - Example: `{{ API_KEY }}` will use `$API_KEY` if set, otherwise asks you to enter it
114
+
115
+ 2. **Auto Port Assignment**: `{{ auto_port() }}`
116
+ - Automatically assigns available ports
117
+ - Avoids conflicts with other sprout environments
118
+ - Checks system port availability
119
+
120
+ 3. **Docker Compose Syntax (Preserved)**: `${VARIABLE}`
121
+ - NOT processed by sprout - passed through as-is
122
+ - Useful for Docker Compose variable substitution
123
+ - Example: `${DB_NAME:-default}` remains unchanged in generated `.env`
124
+
125
+ ### Environment Variable Resolution Example
126
+
127
+ ```bash
128
+ # Set environment variable
129
+ export API_KEY="my-secret-key"
130
+
131
+ # Create sprout environment - API_KEY will be automatically used
132
+ sprout create feature-branch
133
+ # → API_KEY in .env will be set to "my-secret-key" without prompting
134
+
135
+ # For unset variables, sprout will prompt
136
+ sprout create another-branch
137
+ # → Enter a value for 'DATABASE_URL': [user input required]
138
+ ```
139
+
140
+ ## Documentation
141
+
142
+ - [Architecture Overview](docs/sprout-cli/overview.md) - Design philosophy, architecture, and implementation details
143
+ - [Detailed Usage Guide](docs/sprout-cli/usage.md) - Comprehensive usage examples and troubleshooting
144
+
145
+ ## Development
146
+
147
+ ### Setup
148
+ ```bash
149
+ # Install development dependencies
150
+ make setup
151
+ ```
152
+
153
+ ### Testing
154
+ ```bash
155
+ # Run tests
156
+ make test
157
+
158
+ # Run tests with coverage
159
+ make test-cov
160
+ ```
161
+
162
+ ### Code Quality
163
+ ```bash
164
+ # Run linter
165
+ make lint
166
+
167
+ # Format code
168
+ make format
169
+
170
+ # Run type checking
171
+ make typecheck
172
+ ```
173
+
174
+ ## Requirements
175
+
176
+ - Python 3.11+
177
+ - Git
178
+ - Docker Compose (optional, for Docker-based workflows)
179
+
180
+ ## License
181
+
182
+ See LICENSE file.
@@ -0,0 +1,154 @@
1
+ # sprout
2
+
3
+ A CLI tool to automate git worktree and Docker Compose development workflows.
4
+
5
+ ## Features
6
+
7
+ - 🌱 Create isolated development environments using git worktrees
8
+ - 🔧 Automatic `.env` file generation from templates
9
+ - 🚢 Smart port allocation to avoid conflicts
10
+ - 📁 Centralized worktree management in `.sprout/` directory
11
+ - 🎨 Beautiful CLI interface with colors and tables
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install sprout
17
+ ```
18
+
19
+ For development:
20
+ ```bash
21
+ # Clone the repository
22
+ git clone https://github.com/SecDev-Lab/sprout.git
23
+ cd sprout
24
+
25
+ # Install in development mode
26
+ pip install -e ".[dev]"
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ 1. Create a `.env.example` template in your project root:
32
+ ```env
33
+ # API Configuration
34
+ API_KEY={{ API_KEY }}
35
+ API_PORT={{ auto_port() }}
36
+
37
+ # Database Configuration
38
+ DB_HOST=localhost
39
+ DB_PORT={{ auto_port() }}
40
+
41
+ # Example: Docker Compose variables (preserved as-is)
42
+ # sprout will NOT process ${...} syntax - it's passed through unchanged
43
+ # DB_NAME=${DB_NAME}
44
+ ```
45
+
46
+ 2. Create a new development environment:
47
+ ```bash
48
+ sprout create feature-branch
49
+ ```
50
+
51
+ 3. Navigate to your new environment:
52
+ ```bash
53
+ cd $(sprout path feature-branch)
54
+ ```
55
+
56
+ 4. Start your services:
57
+ ```bash
58
+ docker compose up -d
59
+ ```
60
+
61
+ ## Commands
62
+
63
+ ### `sprout create <branch-name>`
64
+ Create a new development environment with automated setup.
65
+
66
+ ### `sprout ls`
67
+ List all managed development environments with their status.
68
+
69
+ ### `sprout rm <branch-name>`
70
+ Remove a development environment (with confirmation prompts).
71
+
72
+ ### `sprout path <branch-name>`
73
+ Get the filesystem path of a development environment.
74
+
75
+ ### `sprout --version`
76
+ Show the version of sprout.
77
+
78
+ ## Template Syntax
79
+
80
+ sprout supports two types of placeholders in `.env.example`:
81
+
82
+ 1. **Variable Placeholders**: `{{ VARIABLE_NAME }}`
83
+ - **First**: Checks if the variable exists in your environment (e.g., `export API_KEY=xxx`)
84
+ - **Then**: If not found in environment, prompts for user input
85
+ - Example: `{{ API_KEY }}` will use `$API_KEY` if set, otherwise asks you to enter it
86
+
87
+ 2. **Auto Port Assignment**: `{{ auto_port() }}`
88
+ - Automatically assigns available ports
89
+ - Avoids conflicts with other sprout environments
90
+ - Checks system port availability
91
+
92
+ 3. **Docker Compose Syntax (Preserved)**: `${VARIABLE}`
93
+ - NOT processed by sprout - passed through as-is
94
+ - Useful for Docker Compose variable substitution
95
+ - Example: `${DB_NAME:-default}` remains unchanged in generated `.env`
96
+
97
+ ### Environment Variable Resolution Example
98
+
99
+ ```bash
100
+ # Set environment variable
101
+ export API_KEY="my-secret-key"
102
+
103
+ # Create sprout environment - API_KEY will be automatically used
104
+ sprout create feature-branch
105
+ # → API_KEY in .env will be set to "my-secret-key" without prompting
106
+
107
+ # For unset variables, sprout will prompt
108
+ sprout create another-branch
109
+ # → Enter a value for 'DATABASE_URL': [user input required]
110
+ ```
111
+
112
+ ## Documentation
113
+
114
+ - [Architecture Overview](docs/sprout-cli/overview.md) - Design philosophy, architecture, and implementation details
115
+ - [Detailed Usage Guide](docs/sprout-cli/usage.md) - Comprehensive usage examples and troubleshooting
116
+
117
+ ## Development
118
+
119
+ ### Setup
120
+ ```bash
121
+ # Install development dependencies
122
+ make setup
123
+ ```
124
+
125
+ ### Testing
126
+ ```bash
127
+ # Run tests
128
+ make test
129
+
130
+ # Run tests with coverage
131
+ make test-cov
132
+ ```
133
+
134
+ ### Code Quality
135
+ ```bash
136
+ # Run linter
137
+ make lint
138
+
139
+ # Format code
140
+ make format
141
+
142
+ # Run type checking
143
+ make typecheck
144
+ ```
145
+
146
+ ## Requirements
147
+
148
+ - Python 3.11+
149
+ - Git
150
+ - Docker Compose (optional, for Docker-based workflows)
151
+
152
+ ## License
153
+
154
+ See LICENSE file.
@@ -0,0 +1,125 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "sprout-cli"
7
+ dynamic = ["version"]
8
+ description = "CLI tool to automate git worktree and Docker Compose development workflows"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "SecDevLab Inc."},
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Version Control :: Git",
24
+ "Topic :: Software Development :: Build Tools",
25
+ ]
26
+ dependencies = [
27
+ "typer>=0.9.0",
28
+ "rich>=13.0.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=7.0",
34
+ "pytest-cov>=4.0",
35
+ "pytest-mock>=3.0",
36
+ "ruff>=0.1.0",
37
+ "mypy>=1.5.0",
38
+ "types-setuptools>=68.0",
39
+ ]
40
+
41
+ [project.scripts]
42
+ sprout = "sprout.__main__:main"
43
+
44
+ [tool.hatch.version]
45
+ path = "src/sprout/__init__.py"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["src/sprout"]
49
+
50
+ [tool.hatch.build.targets.sdist]
51
+ include = [
52
+ "/src",
53
+ "/tests",
54
+ "/README.md",
55
+ "/LICENSE",
56
+ "/pyproject.toml",
57
+ ]
58
+
59
+ [tool.ruff]
60
+ target-version = "py313"
61
+ line-length = 100
62
+
63
+ [tool.ruff.lint]
64
+ select = [
65
+ "E", # pycodestyle errors
66
+ "W", # pycodestyle warnings
67
+ "F", # pyflakes
68
+ "I", # isort
69
+ "B", # flake8-bugbear
70
+ "C4", # flake8-comprehensions
71
+ "UP", # pyupgrade
72
+ ]
73
+ ignore = [
74
+ "UP040", # TypeAlias annotations - not compatible with typer
75
+ ]
76
+
77
+ [tool.ruff.lint.per-file-ignores]
78
+ "tests/*" = ["S101", "S103"]
79
+ "src/sprout/cli.py" = ["B008"] # Typer uses function calls in defaults
80
+
81
+ [tool.pytest.ini_options]
82
+ testpaths = ["tests"]
83
+ pythonpath = ["src"]
84
+ addopts = [
85
+ "--strict-markers",
86
+ "--verbose",
87
+ ]
88
+
89
+ [tool.coverage.run]
90
+ source_pkgs = ["sprout"]
91
+ branch = true
92
+ parallel = true
93
+ omit = [
94
+ "src/sprout/__main__.py",
95
+ ]
96
+
97
+ [tool.coverage.report]
98
+ exclude_lines = [
99
+ "if __name__ == .__main__.:",
100
+ "if TYPE_CHECKING:",
101
+ "raise NotImplementedError",
102
+ ]
103
+
104
+ [tool.mypy]
105
+ python_version = "3.11"
106
+ warn_return_any = true
107
+ warn_unused_configs = true
108
+ disallow_untyped_defs = true
109
+ disallow_incomplete_defs = true
110
+ check_untyped_defs = true
111
+ disallow_untyped_decorators = true
112
+ no_implicit_optional = true
113
+ warn_redundant_casts = true
114
+ warn_unused_ignores = true
115
+ warn_no_return = true
116
+ warn_unreachable = true
117
+ strict_equality = true
118
+ strict = true
119
+ ignore_missing_imports = true
120
+
121
+ # Per-module options
122
+ [[tool.mypy.overrides]]
123
+ module = "tests.*"
124
+ disallow_untyped_defs = false
125
+ disallow_incomplete_defs = false
@@ -0,0 +1,3 @@
1
+ """sprout - CLI tool to automate git worktree and Docker Compose development workflows."""
2
+
3
+ __version__ = "0.2.0"
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env python3
2
+ """Entry point for the sprout CLI."""
3
+
4
+ from sprout.cli import app
5
+
6
+
7
+ def main() -> None:
8
+ """Run the sprout CLI application."""
9
+ app()
10
+
11
+
12
+ if __name__ == "__main__":
13
+ main()