devs-cli 0.1.0__py3-none-any.whl
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.
- devs/__init__.py +18 -0
- devs/cli.py +834 -0
- devs/config.py +44 -0
- devs/core/__init__.py +8 -0
- devs/core/integration.py +290 -0
- devs/exceptions.py +24 -0
- devs/utils/__init__.py +28 -0
- devs_cli-0.1.0.dist-info/METADATA +185 -0
- devs_cli-0.1.0.dist-info/RECORD +13 -0
- devs_cli-0.1.0.dist-info/WHEEL +5 -0
- devs_cli-0.1.0.dist-info/entry_points.txt +2 -0
- devs_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
- devs_cli-0.1.0.dist-info/top_level.txt +1 -0
devs/config.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Configuration management for devs package."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
from devs_common.config import BaseConfig
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Config(BaseConfig):
|
|
11
|
+
"""Configuration settings for devs CLI."""
|
|
12
|
+
|
|
13
|
+
# Default settings
|
|
14
|
+
PROJECT_PREFIX = "dev"
|
|
15
|
+
WORKSPACES_DIR = Path.home() / ".devs" / "workspaces"
|
|
16
|
+
CLAUDE_CONFIG_DIR = Path.home() / ".devs" / "claudeconfig"
|
|
17
|
+
|
|
18
|
+
def __init__(self) -> None:
|
|
19
|
+
"""Initialize configuration with environment variable overrides."""
|
|
20
|
+
super().__init__()
|
|
21
|
+
|
|
22
|
+
# CLI-specific configuration
|
|
23
|
+
claude_config_env = os.getenv("DEVS_CLAUDE_CONFIG_DIR")
|
|
24
|
+
if claude_config_env:
|
|
25
|
+
self.claude_config_dir = Path(claude_config_env)
|
|
26
|
+
else:
|
|
27
|
+
self.claude_config_dir = self.CLAUDE_CONFIG_DIR
|
|
28
|
+
|
|
29
|
+
def get_default_workspaces_dir(self) -> Path:
|
|
30
|
+
"""Get default workspaces directory for CLI package."""
|
|
31
|
+
return self.WORKSPACES_DIR
|
|
32
|
+
|
|
33
|
+
def get_default_project_prefix(self) -> str:
|
|
34
|
+
"""Get default project prefix for CLI package."""
|
|
35
|
+
return self.PROJECT_PREFIX
|
|
36
|
+
|
|
37
|
+
def ensure_directories(self) -> None:
|
|
38
|
+
"""Ensure required directories exist."""
|
|
39
|
+
super().ensure_directories()
|
|
40
|
+
self.claude_config_dir.mkdir(parents=True, exist_ok=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Global config instance
|
|
44
|
+
config = Config()
|
devs/core/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Core functionality for devcontainer management."""
|
|
2
|
+
|
|
3
|
+
# Import from common package
|
|
4
|
+
from devs_common.core.project import Project, ProjectInfo
|
|
5
|
+
from devs_common.core.workspace import WorkspaceManager
|
|
6
|
+
from devs_common.core.container import ContainerManager, ContainerInfo
|
|
7
|
+
|
|
8
|
+
__all__ = ["Project", "ProjectInfo", "WorkspaceManager", "ContainerManager", "ContainerInfo"]
|
devs/core/integration.py
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"""VS Code and external tool integrations."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import time
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import List
|
|
7
|
+
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
|
|
10
|
+
from ..exceptions import VSCodeError, DependencyError
|
|
11
|
+
from devs_common.core.project import Project
|
|
12
|
+
from devs_common.utils.devcontainer import prepare_devcontainer_environment
|
|
13
|
+
|
|
14
|
+
console = Console()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class VSCodeIntegration:
|
|
18
|
+
"""Handles VS Code integration and launching."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, project: Project) -> None:
|
|
21
|
+
"""Initialize VS Code integration.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
project: Project instance
|
|
25
|
+
"""
|
|
26
|
+
self.project = project
|
|
27
|
+
self._check_vscode_cli()
|
|
28
|
+
|
|
29
|
+
def _check_vscode_cli(self) -> None:
|
|
30
|
+
"""Check if VS Code CLI is available.
|
|
31
|
+
|
|
32
|
+
Raises:
|
|
33
|
+
DependencyError: If code command is not found
|
|
34
|
+
"""
|
|
35
|
+
try:
|
|
36
|
+
result = subprocess.run(
|
|
37
|
+
['code', '--version'],
|
|
38
|
+
capture_output=True,
|
|
39
|
+
text=True,
|
|
40
|
+
check=False
|
|
41
|
+
)
|
|
42
|
+
if result.returncode != 0:
|
|
43
|
+
raise DependencyError(
|
|
44
|
+
"VS Code 'code' command not found. Make sure VS Code is installed "
|
|
45
|
+
"and the 'code' command is available in your PATH."
|
|
46
|
+
)
|
|
47
|
+
except FileNotFoundError:
|
|
48
|
+
raise DependencyError(
|
|
49
|
+
"VS Code 'code' command not found. Make sure VS Code is installed "
|
|
50
|
+
"and the 'code' command is available in your PATH."
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def generate_devcontainer_uri(self, workspace_dir: Path, dev_name: str, live: bool = False, attach_to_existing: bool = True) -> str:
|
|
54
|
+
"""Generate VS Code devcontainer URI.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
workspace_dir: Workspace directory path
|
|
58
|
+
dev_name: Development environment name
|
|
59
|
+
live: Whether to use live mode (mount current directory)
|
|
60
|
+
attach_to_existing: Whether to attach to existing container (vs create new one)
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
VS Code devcontainer URI
|
|
64
|
+
"""
|
|
65
|
+
if attach_to_existing:
|
|
66
|
+
# Generate container name to attach to
|
|
67
|
+
container_name = self.project.get_container_name(dev_name)
|
|
68
|
+
# Use attached-container URI format to connect to existing container
|
|
69
|
+
# Encode container name for URI
|
|
70
|
+
container_hex = container_name.encode('utf-8').hex()
|
|
71
|
+
|
|
72
|
+
# Generate workspace path inside container
|
|
73
|
+
workspace_name = workspace_dir.name if live else self.project.get_workspace_name(dev_name)
|
|
74
|
+
vscode_uri = f"vscode-remote://attached-container+{container_hex}/workspaces/{workspace_name}"
|
|
75
|
+
else:
|
|
76
|
+
# Original behavior: create new container from devcontainer.json
|
|
77
|
+
# Convert workspace path to hex for VS Code URI
|
|
78
|
+
workspace_hex = workspace_dir.as_posix().encode('utf-8').hex()
|
|
79
|
+
|
|
80
|
+
# Generate workspace name inside container
|
|
81
|
+
# IMPORTANT: In live mode, we must use the actual host folder name (e.g. "workstuff")
|
|
82
|
+
# because devcontainer CLI mounts the host directory directly, preserving its name.
|
|
83
|
+
# VS Code needs to connect to /workspaces/<host-folder-name>, not our constructed name.
|
|
84
|
+
workspace_name = workspace_dir.name if live else self.project.get_workspace_name(dev_name)
|
|
85
|
+
|
|
86
|
+
# Build VS Code devcontainer URI
|
|
87
|
+
vscode_uri = f"vscode-remote://dev-container+{workspace_hex}/workspaces/{workspace_name}"
|
|
88
|
+
|
|
89
|
+
return vscode_uri
|
|
90
|
+
|
|
91
|
+
def launch_devcontainer(
|
|
92
|
+
self,
|
|
93
|
+
workspace_dir: Path,
|
|
94
|
+
dev_name: str,
|
|
95
|
+
new_window: bool = True,
|
|
96
|
+
live: bool = False
|
|
97
|
+
) -> bool:
|
|
98
|
+
"""Launch a devcontainer in VS Code.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
workspace_dir: Workspace directory path
|
|
102
|
+
dev_name: Development environment name
|
|
103
|
+
new_window: Whether to open in a new window
|
|
104
|
+
live: Whether to use live mode (mount current directory)
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
True if VS Code launched successfully
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
VSCodeError: If VS Code launch fails
|
|
111
|
+
"""
|
|
112
|
+
try:
|
|
113
|
+
# Always attach to existing container (since we ensure it's running in CLI)
|
|
114
|
+
vscode_uri = self.generate_devcontainer_uri(workspace_dir, dev_name, live, attach_to_existing=True)
|
|
115
|
+
|
|
116
|
+
console.print(f" 🚀 Opening VS Code for: {dev_name}")
|
|
117
|
+
|
|
118
|
+
# Build VS Code command
|
|
119
|
+
cmd = ['code']
|
|
120
|
+
|
|
121
|
+
if new_window:
|
|
122
|
+
cmd.append('--new-window')
|
|
123
|
+
|
|
124
|
+
cmd.extend(['--folder-uri', vscode_uri])
|
|
125
|
+
|
|
126
|
+
# Set environment variables using shared function
|
|
127
|
+
container_workspace_name = self.project.get_workspace_name(dev_name)
|
|
128
|
+
env = prepare_devcontainer_environment(
|
|
129
|
+
dev_name=dev_name,
|
|
130
|
+
project_name=self.project.info.name,
|
|
131
|
+
workspace_folder=workspace_dir,
|
|
132
|
+
container_workspace_name=container_workspace_name,
|
|
133
|
+
git_remote_url=self.project.info.git_remote_url,
|
|
134
|
+
debug=False, # VS Code launch doesn't need debug mode
|
|
135
|
+
live=live
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Launch VS Code in background
|
|
139
|
+
process = subprocess.Popen(
|
|
140
|
+
cmd,
|
|
141
|
+
env=env,
|
|
142
|
+
stdout=subprocess.DEVNULL,
|
|
143
|
+
stderr=subprocess.DEVNULL,
|
|
144
|
+
start_new_session=True
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Give it a moment to start
|
|
148
|
+
time.sleep(1)
|
|
149
|
+
|
|
150
|
+
# Check if process is still running (not immediately failed)
|
|
151
|
+
if process.poll() is not None and process.returncode != 0:
|
|
152
|
+
raise VSCodeError(f"VS Code process exited with code {process.returncode}")
|
|
153
|
+
|
|
154
|
+
console.print(f" ✅ Launched VS Code for: {dev_name}")
|
|
155
|
+
return True
|
|
156
|
+
|
|
157
|
+
except subprocess.SubprocessError as e:
|
|
158
|
+
raise VSCodeError(f"Failed to launch VS Code for {dev_name}: {e}")
|
|
159
|
+
|
|
160
|
+
def launch_multiple_devcontainers(
|
|
161
|
+
self,
|
|
162
|
+
workspace_dirs: List[Path],
|
|
163
|
+
dev_names: List[str],
|
|
164
|
+
delay_between_windows: float = 2.0,
|
|
165
|
+
live: bool = False
|
|
166
|
+
) -> int:
|
|
167
|
+
"""Launch multiple devcontainers in separate VS Code windows.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
workspace_dirs: List of workspace directory paths
|
|
171
|
+
dev_names: List of development environment names
|
|
172
|
+
delay_between_windows: Delay between opening windows (seconds)
|
|
173
|
+
live: Whether to use live mode (mount current directory)
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Number of successfully launched windows
|
|
177
|
+
"""
|
|
178
|
+
if len(workspace_dirs) != len(dev_names):
|
|
179
|
+
raise VSCodeError("Workspace directories and dev names lists must have same length")
|
|
180
|
+
|
|
181
|
+
console.print(f"📂 Opening {len(dev_names)} devcontainers in VS Code for project: {self.project.info.name}")
|
|
182
|
+
|
|
183
|
+
success_count = 0
|
|
184
|
+
|
|
185
|
+
for workspace_dir, dev_name in zip(workspace_dirs, dev_names):
|
|
186
|
+
try:
|
|
187
|
+
if self.launch_devcontainer(workspace_dir, dev_name, new_window=True, live=live):
|
|
188
|
+
success_count += 1
|
|
189
|
+
|
|
190
|
+
# Add delay between windows to ensure they open separately
|
|
191
|
+
if delay_between_windows > 0:
|
|
192
|
+
time.sleep(delay_between_windows)
|
|
193
|
+
|
|
194
|
+
except VSCodeError as e:
|
|
195
|
+
console.print(f" ❌ Failed to launch {dev_name}: {e}")
|
|
196
|
+
continue
|
|
197
|
+
|
|
198
|
+
if success_count > 0:
|
|
199
|
+
console.print("")
|
|
200
|
+
console.print(f"💡 VS Code windows should open shortly with titles: '<dev-name> - {self.project.info.directory.name}'")
|
|
201
|
+
|
|
202
|
+
return success_count
|
|
203
|
+
|
|
204
|
+
class ExternalToolIntegration:
|
|
205
|
+
"""Handles integration with external development tools."""
|
|
206
|
+
|
|
207
|
+
def __init__(self, project: Project) -> None:
|
|
208
|
+
"""Initialize external tool integration.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
project: Project instance
|
|
212
|
+
"""
|
|
213
|
+
self.project = project
|
|
214
|
+
|
|
215
|
+
def check_dependencies(self) -> dict:
|
|
216
|
+
"""Check availability of external dependencies.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
Dictionary mapping tool names to availability status
|
|
220
|
+
"""
|
|
221
|
+
tools = {
|
|
222
|
+
'docker': ['docker', '--version'],
|
|
223
|
+
'devcontainer': ['devcontainer', '--version'],
|
|
224
|
+
'code': ['code', '--version'],
|
|
225
|
+
'git': ['git', '--version'],
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
status = {}
|
|
229
|
+
|
|
230
|
+
for tool_name, cmd in tools.items():
|
|
231
|
+
try:
|
|
232
|
+
result = subprocess.run(
|
|
233
|
+
cmd,
|
|
234
|
+
capture_output=True,
|
|
235
|
+
text=True,
|
|
236
|
+
check=False
|
|
237
|
+
)
|
|
238
|
+
status[tool_name] = {
|
|
239
|
+
'available': result.returncode == 0,
|
|
240
|
+
'version': result.stdout.strip() if result.returncode == 0 else None,
|
|
241
|
+
'error': result.stderr.strip() if result.returncode != 0 else None
|
|
242
|
+
}
|
|
243
|
+
except FileNotFoundError:
|
|
244
|
+
status[tool_name] = {
|
|
245
|
+
'available': False,
|
|
246
|
+
'version': None,
|
|
247
|
+
'error': 'Command not found'
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return status
|
|
251
|
+
|
|
252
|
+
def print_dependency_status(self) -> None:
|
|
253
|
+
"""Print status of all dependencies."""
|
|
254
|
+
status = self.check_dependencies()
|
|
255
|
+
|
|
256
|
+
console.print("\n🔧 Dependency Status:")
|
|
257
|
+
console.print("─" * 40)
|
|
258
|
+
|
|
259
|
+
for tool_name, info in status.items():
|
|
260
|
+
if info['available']:
|
|
261
|
+
console.print(f" ✅ {tool_name}: {info['version']}")
|
|
262
|
+
else:
|
|
263
|
+
console.print(f" ❌ {tool_name}: {info['error']}")
|
|
264
|
+
|
|
265
|
+
# Check for missing critical dependencies
|
|
266
|
+
critical_tools = ['docker', 'devcontainer']
|
|
267
|
+
missing_critical = [
|
|
268
|
+
tool for tool in critical_tools
|
|
269
|
+
if not status.get(tool, {}).get('available', False)
|
|
270
|
+
]
|
|
271
|
+
|
|
272
|
+
if missing_critical:
|
|
273
|
+
console.print(f"\n⚠️ Missing critical dependencies: {', '.join(missing_critical)}")
|
|
274
|
+
console.print(" Please install missing tools before using devs.")
|
|
275
|
+
else:
|
|
276
|
+
console.print("\n✅ All critical dependencies are available.")
|
|
277
|
+
|
|
278
|
+
def get_missing_dependencies(self) -> List[str]:
|
|
279
|
+
"""Get list of missing critical dependencies.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
List of missing tool names
|
|
283
|
+
"""
|
|
284
|
+
status = self.check_dependencies()
|
|
285
|
+
critical_tools = ['docker', 'devcontainer']
|
|
286
|
+
|
|
287
|
+
return [
|
|
288
|
+
tool for tool in critical_tools
|
|
289
|
+
if not status.get(tool, {}).get('available', False)
|
|
290
|
+
]
|
devs/exceptions.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Custom exceptions for devs package."""
|
|
2
|
+
|
|
3
|
+
# Import from common package for compatibility
|
|
4
|
+
from devs_common.exceptions import (
|
|
5
|
+
DevsError,
|
|
6
|
+
ProjectNotFoundError,
|
|
7
|
+
DevcontainerConfigError,
|
|
8
|
+
ContainerError,
|
|
9
|
+
DockerError,
|
|
10
|
+
WorkspaceError,
|
|
11
|
+
VSCodeError,
|
|
12
|
+
DependencyError,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"DevsError",
|
|
17
|
+
"ProjectNotFoundError",
|
|
18
|
+
"DevcontainerConfigError",
|
|
19
|
+
"ContainerError",
|
|
20
|
+
"DockerError",
|
|
21
|
+
"WorkspaceError",
|
|
22
|
+
"VSCodeError",
|
|
23
|
+
"DependencyError",
|
|
24
|
+
]
|
devs/utils/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Utility modules for devcontainer management."""
|
|
2
|
+
|
|
3
|
+
# Import from common package for compatibility
|
|
4
|
+
from devs_common.utils import (
|
|
5
|
+
copy_file_list,
|
|
6
|
+
copy_directory_tree,
|
|
7
|
+
safe_remove_directory,
|
|
8
|
+
ensure_directory_exists,
|
|
9
|
+
get_directory_size,
|
|
10
|
+
is_directory_empty,
|
|
11
|
+
get_tracked_files,
|
|
12
|
+
is_git_repository,
|
|
13
|
+
DockerClient,
|
|
14
|
+
DevContainerCLI,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"copy_file_list",
|
|
19
|
+
"copy_directory_tree",
|
|
20
|
+
"safe_remove_directory",
|
|
21
|
+
"ensure_directory_exists",
|
|
22
|
+
"get_directory_size",
|
|
23
|
+
"is_directory_empty",
|
|
24
|
+
"get_tracked_files",
|
|
25
|
+
"is_git_repository",
|
|
26
|
+
"DockerClient",
|
|
27
|
+
"DevContainerCLI",
|
|
28
|
+
]
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devs-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: DevContainer Management Tool - Manage multiple named devcontainers for any project
|
|
5
|
+
Author: Dan Lester
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ideonate/devs
|
|
8
|
+
Project-URL: Repository, https://github.com/ideonate/devs
|
|
9
|
+
Project-URL: Issues, https://github.com/ideonate/devs/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/ideonate/devs/tree/main/packages/cli
|
|
11
|
+
Keywords: devcontainer,docker,vscode,development
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: click>=8.0.0
|
|
28
|
+
Requires-Dist: devs-common>=0.1.0
|
|
29
|
+
Requires-Dist: rich>=12.0.0
|
|
30
|
+
Requires-Dist: pathspec>=0.10.0
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
35
|
+
Requires-Dist: black; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8; extra == "dev"
|
|
38
|
+
Requires-Dist: build>=0.10.0; extra == "dev"
|
|
39
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# devs - DevContainer Management Tool
|
|
43
|
+
|
|
44
|
+
A Python command-line tool that simplifies managing multiple named devcontainers for any project.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Multiple Named Containers**: Start multiple devcontainers with custom names (e.g., "sally", "bob", "charlie")
|
|
49
|
+
- **VS Code Integration**: Open containers in separate VS Code windows with clear titles
|
|
50
|
+
- **Project Isolation**: Containers are prefixed with git repository names (org-repo format)
|
|
51
|
+
- **Environment Variable Management**: Layered DEVS.yml configuration with user-specific overrides
|
|
52
|
+
- **Shared Authentication**: Claude credentials are shared between containers for the same project
|
|
53
|
+
- **Cross-Platform**: Works on any project with devcontainer configuration
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install devs
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Start development environments
|
|
65
|
+
devs start frontend backend
|
|
66
|
+
|
|
67
|
+
# Open both in VS Code (separate windows)
|
|
68
|
+
devs vscode frontend backend
|
|
69
|
+
|
|
70
|
+
# Work in a specific container
|
|
71
|
+
devs shell frontend
|
|
72
|
+
|
|
73
|
+
# Run Claude in a container
|
|
74
|
+
devs claude frontend "Summarize this codebase"
|
|
75
|
+
|
|
76
|
+
# Run tests in a container
|
|
77
|
+
devs runtests frontend
|
|
78
|
+
|
|
79
|
+
# Environment variables support
|
|
80
|
+
devs start frontend --env DEBUG=true --env API_URL=http://localhost:3000
|
|
81
|
+
devs claude frontend "Fix the tests" --env NODE_ENV=test
|
|
82
|
+
|
|
83
|
+
# Set up Claude authentication (once per host)
|
|
84
|
+
devs claude-auth
|
|
85
|
+
# Or with API key
|
|
86
|
+
devs claude-auth --api-key <YOUR_API_KEY>
|
|
87
|
+
|
|
88
|
+
# Clean up when done
|
|
89
|
+
devs stop frontend backend
|
|
90
|
+
|
|
91
|
+
# List active containers
|
|
92
|
+
devs list
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Configuration
|
|
96
|
+
|
|
97
|
+
### Environment Variables
|
|
98
|
+
|
|
99
|
+
devs supports layered environment variable configuration through DEVS.yml files:
|
|
100
|
+
|
|
101
|
+
**Priority order (highest to lowest):**
|
|
102
|
+
1. CLI `--env` flags
|
|
103
|
+
2. `~/.devs/envs/{org-repo}/DEVS.yml` (user-specific project overrides)
|
|
104
|
+
3. `~/.devs/envs/default/DEVS.yml` (user defaults)
|
|
105
|
+
4. `{project-root}/DEVS.yml` (repository configuration)
|
|
106
|
+
|
|
107
|
+
**Example DEVS.yml in your project:**
|
|
108
|
+
```yaml
|
|
109
|
+
env_vars:
|
|
110
|
+
default:
|
|
111
|
+
NODE_ENV: development
|
|
112
|
+
API_URL: https://api.example.com
|
|
113
|
+
DEBUG: "false"
|
|
114
|
+
|
|
115
|
+
frontend: # Container-specific overrides
|
|
116
|
+
DEBUG: "true"
|
|
117
|
+
FRONTEND_PORT: "3000"
|
|
118
|
+
|
|
119
|
+
backend:
|
|
120
|
+
NODE_ENV: production
|
|
121
|
+
API_URL: https://prod-api.example.com
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**User-specific configuration:**
|
|
125
|
+
```bash
|
|
126
|
+
# Global user defaults
|
|
127
|
+
mkdir -p ~/.devs/envs/default
|
|
128
|
+
echo 'env_vars:
|
|
129
|
+
default:
|
|
130
|
+
GLOBAL_SETTING: "user_preference"
|
|
131
|
+
MY_SECRET: "user_secret"' > ~/.devs/envs/default/DEVS.yml
|
|
132
|
+
|
|
133
|
+
# Project-specific overrides (org-repo format)
|
|
134
|
+
mkdir -p ~/.devs/envs/myorg-myproject
|
|
135
|
+
echo 'env_vars:
|
|
136
|
+
frontend:
|
|
137
|
+
DEBUG: "true"
|
|
138
|
+
LOCAL_SECRET: "dev_secret"' > ~/.devs/envs/myorg-myproject/DEVS.yml
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
📖 **[See ../../example-usage.md for detailed examples and scenarios](../../example-usage.md)**
|
|
142
|
+
|
|
143
|
+
## Requirements
|
|
144
|
+
|
|
145
|
+
- **Docker**: Container runtime
|
|
146
|
+
- **VS Code**: With `code` command in PATH
|
|
147
|
+
- **DevContainer CLI**: `npm install -g @devcontainers/cli`
|
|
148
|
+
- **Project Requirements**: `.devcontainer/devcontainer.json` in target projects
|
|
149
|
+
|
|
150
|
+
## Architecture
|
|
151
|
+
|
|
152
|
+
### Container Naming
|
|
153
|
+
Containers follow the pattern: `dev-<org>-<repo>-<dev-name>`
|
|
154
|
+
|
|
155
|
+
Example: `dev-ideonate-devs-sally`, `dev-ideonate-devs-bob`
|
|
156
|
+
|
|
157
|
+
### VS Code Window Management
|
|
158
|
+
Each container gets unique workspace paths to ensure VS Code treats them as separate sessions.
|
|
159
|
+
|
|
160
|
+
### Claude Authentication Sharing
|
|
161
|
+
The tool creates symlinks so all containers for the same project share Claude authentication.
|
|
162
|
+
|
|
163
|
+
## Development
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Clone repository
|
|
167
|
+
git clone https://github.com/ideonate/devs.git
|
|
168
|
+
cd devs/python-devs
|
|
169
|
+
|
|
170
|
+
# Install in development mode
|
|
171
|
+
pip install -e ".[dev]"
|
|
172
|
+
|
|
173
|
+
# Run tests
|
|
174
|
+
pytest
|
|
175
|
+
|
|
176
|
+
# Format code
|
|
177
|
+
black devs tests
|
|
178
|
+
|
|
179
|
+
# Type checking
|
|
180
|
+
mypy devs
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT License
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
devs/__init__.py,sha256=ML7Y2NiarUaL6dwWM5MqdmUjyJN3Unq3VNm8ZogojZM,433
|
|
2
|
+
devs/cli.py,sha256=IHn3aUXyaWVPFwL0iLlEseXtiPq7itkCijh4nJpTDC8,32727
|
|
3
|
+
devs/config.py,sha256=EhCpt-DsRX6o2LU31rc5kBsgm_DQ1v7wywc9qptmyj4,1366
|
|
4
|
+
devs/exceptions.py,sha256=7xO7ihJu_U6CupZPMv89B4N5EBSUcdj2OdA6GPAFPEE,490
|
|
5
|
+
devs/core/__init__.py,sha256=TPy3eZi-AEztci_QZ37YAAl2zvUQlwBALpyiQx2ED7Q,363
|
|
6
|
+
devs/core/integration.py,sha256=YOz03TvS5Rk8YYnPT_rbEB_EMjpkOY4Z7OEzeP-6ZZQ,11055
|
|
7
|
+
devs/utils/__init__.py,sha256=f-sEWETPfW2Xkaxgd-l6FS-jIQAorLlQZOicIZvp-W0,638
|
|
8
|
+
devs_cli-0.1.0.dist-info/licenses/LICENSE,sha256=bi2EUiv-lmC_quQVkNqzTYXJpjVarkPsVKfqhJl7ccQ,1067
|
|
9
|
+
devs_cli-0.1.0.dist-info/METADATA,sha256=sqYKHWdUTuNXPRr0eEIJpl7p-7VkZSDcDO1gvTQTyN8,5278
|
|
10
|
+
devs_cli-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
devs_cli-0.1.0.dist-info/entry_points.txt,sha256=s8-pgqZ1QvzPJgHP9vNxwBYdezmGsFdRUHacJPZ4WOs,39
|
|
12
|
+
devs_cli-0.1.0.dist-info/top_level.txt,sha256=9RIVUPVGuOdO84qkBh_9XcKoTV7773o3py78wz2-IZk,5
|
|
13
|
+
devs_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dan Lester
|
|
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 @@
|
|
|
1
|
+
devs
|