devs-cli 3.2.2__py3-none-any.whl → 3.2.4__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/cli.py +15 -89
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/METADATA +1 -1
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/RECORD +7 -7
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/WHEEL +1 -1
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/entry_points.txt +0 -0
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/licenses/LICENSE +0 -0
- {devs_cli-3.2.2.dist-info → devs_cli-3.2.4.dist-info}/top_level.txt +0 -0
devs/cli.py
CHANGED
|
@@ -11,7 +11,6 @@ from rich.console import Console
|
|
|
11
11
|
from rich.table import Table
|
|
12
12
|
|
|
13
13
|
from .config import config
|
|
14
|
-
from pathlib import Path
|
|
15
14
|
from .core import Project, ContainerManager, WorkspaceManager
|
|
16
15
|
from .core.integration import VSCodeIntegration, ExternalToolIntegration
|
|
17
16
|
from devs_common.devs_config import DevsConfigLoader
|
|
@@ -362,13 +361,12 @@ def shell(dev_name: str, live: bool, env: tuple, debug: bool) -> None:
|
|
|
362
361
|
@cli.command()
|
|
363
362
|
@click.argument('dev_name', required=False)
|
|
364
363
|
@click.argument('prompt', required=False)
|
|
365
|
-
@click.option('--auth', is_flag=True, help='
|
|
366
|
-
@click.option('--api-key', help='Claude API key to authenticate with (use with --auth)')
|
|
364
|
+
@click.option('--auth', is_flag=True, help='Show Claude authentication setup instructions')
|
|
367
365
|
@click.option('--reset-workspace', is_flag=True, help='Reset workspace contents before execution')
|
|
368
366
|
@click.option('--live', is_flag=True, help='Start container with current directory mounted as workspace')
|
|
369
367
|
@click.option('--env', multiple=True, help='Environment variables to pass to container (format: VAR=value)')
|
|
370
368
|
@debug_option
|
|
371
|
-
def claude(dev_name: str, prompt: str, auth: bool,
|
|
369
|
+
def claude(dev_name: str, prompt: str, auth: bool, reset_workspace: bool, live: bool, env: tuple, debug: bool) -> None:
|
|
372
370
|
"""Execute Claude CLI in devcontainer or set up authentication.
|
|
373
371
|
|
|
374
372
|
DEV_NAME: Development environment name
|
|
@@ -378,12 +376,22 @@ def claude(dev_name: str, prompt: str, auth: bool, api_key: str, reset_workspace
|
|
|
378
376
|
Example: devs claude sally "Fix the tests" --reset-workspace
|
|
379
377
|
Example: devs claude sally "Fix the tests" --live # Run with current directory
|
|
380
378
|
Example: devs claude sally "Start the server" --env QUART_PORT=5001
|
|
381
|
-
Example: devs claude --auth #
|
|
382
|
-
Example: devs claude --auth --api-key <YOUR_KEY> # API key authentication
|
|
379
|
+
Example: devs claude --auth # Show auth setup instructions
|
|
383
380
|
"""
|
|
384
381
|
# Handle authentication mode
|
|
385
382
|
if auth:
|
|
386
|
-
|
|
383
|
+
console.print("🔐 Claude authentication for devcontainers")
|
|
384
|
+
console.print("")
|
|
385
|
+
console.print("1. Generate a token (on a machine with a browser):")
|
|
386
|
+
console.print(" [cyan]claude setup-token[/cyan]")
|
|
387
|
+
console.print("")
|
|
388
|
+
console.print("2. Add the token to your environment:")
|
|
389
|
+
console.print(" [cyan]export CLAUDE_CODE_OAUTH_TOKEN=<token>[/cyan]")
|
|
390
|
+
console.print("")
|
|
391
|
+
console.print(" Or add it to [cyan]~/.devs/envs/default/.env[/cyan]:")
|
|
392
|
+
console.print(" [dim]CLAUDE_CODE_OAUTH_TOKEN=<token>[/dim]")
|
|
393
|
+
console.print("")
|
|
394
|
+
console.print("The token will be automatically passed to all devcontainers.")
|
|
387
395
|
return
|
|
388
396
|
|
|
389
397
|
# Validate required arguments for execution mode
|
|
@@ -441,88 +449,6 @@ def claude(dev_name: str, prompt: str, auth: bool, api_key: str, reset_workspace
|
|
|
441
449
|
sys.exit(1)
|
|
442
450
|
|
|
443
451
|
|
|
444
|
-
def _handle_claude_auth(api_key: str, debug: bool) -> None:
|
|
445
|
-
"""Handle Claude authentication setup.
|
|
446
|
-
|
|
447
|
-
This configures Claude authentication that will be shared across
|
|
448
|
-
all devcontainers for this project. The authentication is stored
|
|
449
|
-
on the host and bind-mounted into containers.
|
|
450
|
-
"""
|
|
451
|
-
try:
|
|
452
|
-
# Ensure Claude config directory exists
|
|
453
|
-
config.ensure_directories()
|
|
454
|
-
|
|
455
|
-
console.print("🔐 Setting up Claude authentication...")
|
|
456
|
-
console.print(f" Configuration will be saved to: {config.claude_config_dir}")
|
|
457
|
-
|
|
458
|
-
if api_key:
|
|
459
|
-
# Set API key directly using Claude CLI
|
|
460
|
-
console.print(" Using provided API key...")
|
|
461
|
-
|
|
462
|
-
# Set CLAUDE_CONFIG_DIR to our config directory and run auth with API key
|
|
463
|
-
env = os.environ.copy()
|
|
464
|
-
env['CLAUDE_CONFIG_DIR'] = str(config.claude_config_dir)
|
|
465
|
-
|
|
466
|
-
cmd = ['claude', 'auth', '--key', api_key]
|
|
467
|
-
|
|
468
|
-
if debug:
|
|
469
|
-
console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
|
|
470
|
-
console.print(f"[dim]CLAUDE_CONFIG_DIR: {config.claude_config_dir}[/dim]")
|
|
471
|
-
|
|
472
|
-
result = subprocess.run(
|
|
473
|
-
cmd,
|
|
474
|
-
env=env,
|
|
475
|
-
capture_output=True,
|
|
476
|
-
text=True
|
|
477
|
-
)
|
|
478
|
-
|
|
479
|
-
if result.returncode != 0:
|
|
480
|
-
error_msg = result.stderr or result.stdout or "Unknown error"
|
|
481
|
-
raise Exception(f"Claude authentication failed: {error_msg}")
|
|
482
|
-
|
|
483
|
-
else:
|
|
484
|
-
# Interactive authentication
|
|
485
|
-
console.print(" Starting interactive authentication...")
|
|
486
|
-
console.print(" Follow the prompts to authenticate with Claude")
|
|
487
|
-
console.print("")
|
|
488
|
-
|
|
489
|
-
# Set CLAUDE_CONFIG_DIR to our config directory
|
|
490
|
-
env = os.environ.copy()
|
|
491
|
-
env['CLAUDE_CONFIG_DIR'] = str(config.claude_config_dir)
|
|
492
|
-
|
|
493
|
-
cmd = ['claude', 'auth']
|
|
494
|
-
|
|
495
|
-
if debug:
|
|
496
|
-
console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
|
|
497
|
-
console.print(f"[dim]CLAUDE_CONFIG_DIR: {config.claude_config_dir}[/dim]")
|
|
498
|
-
|
|
499
|
-
# Run interactively
|
|
500
|
-
result = subprocess.run(
|
|
501
|
-
cmd,
|
|
502
|
-
env=env,
|
|
503
|
-
check=False
|
|
504
|
-
)
|
|
505
|
-
|
|
506
|
-
if result.returncode != 0:
|
|
507
|
-
raise Exception("Claude authentication was cancelled or failed")
|
|
508
|
-
|
|
509
|
-
console.print("")
|
|
510
|
-
console.print("✅ Claude authentication configured successfully!")
|
|
511
|
-
console.print(f" Configuration saved to: {config.claude_config_dir}")
|
|
512
|
-
console.print(" This authentication will be shared across all devcontainers")
|
|
513
|
-
console.print("")
|
|
514
|
-
console.print("💡 You can now use Claude in any devcontainer:")
|
|
515
|
-
console.print(" devs claude <dev-name> 'Your prompt here'")
|
|
516
|
-
|
|
517
|
-
except FileNotFoundError:
|
|
518
|
-
console.print("❌ Claude CLI not found on host machine")
|
|
519
|
-
console.print("")
|
|
520
|
-
console.print("Please install Claude CLI first:")
|
|
521
|
-
console.print(" npm install -g @anthropic-ai/claude-cli")
|
|
522
|
-
console.print("")
|
|
523
|
-
console.print("Note: Claude needs to be installed on the host machine")
|
|
524
|
-
console.print(" for authentication. It's already available in containers.")
|
|
525
|
-
sys.exit(1)
|
|
526
452
|
|
|
527
453
|
except Exception as e:
|
|
528
454
|
console.print(f"❌ Failed to configure Claude authentication: {e}")
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
devs/__init__.py,sha256=dMk0J_JrmBmknPvt6HNUa04qxgHYpxhnIXa3PZFk_N0,571
|
|
2
|
-
devs/cli.py,sha256=
|
|
2
|
+
devs/cli.py,sha256=S3XILHevXMJxuidYjW7OS2cwi_ikS6lbeyJHemw5BBM,41545
|
|
3
3
|
devs/config.py,sha256=DaS2_1x0h63cHn34RmWbEhUx_1u3-sAo16tM3AXMKfQ,1561
|
|
4
4
|
devs/exceptions.py,sha256=7xO7ihJu_U6CupZPMv89B4N5EBSUcdj2OdA6GPAFPEE,490
|
|
5
5
|
devs/core/__init__.py,sha256=TPy3eZi-AEztci_QZ37YAAl2zvUQlwBALpyiQx2ED7Q,363
|
|
6
6
|
devs/core/integration.py,sha256=YOz03TvS5Rk8YYnPT_rbEB_EMjpkOY4Z7OEzeP-6ZZQ,11055
|
|
7
7
|
devs/utils/__init__.py,sha256=f-sEWETPfW2Xkaxgd-l6FS-jIQAorLlQZOicIZvp-W0,638
|
|
8
|
-
devs_cli-3.2.
|
|
9
|
-
devs_cli-3.2.
|
|
10
|
-
devs_cli-3.2.
|
|
11
|
-
devs_cli-3.2.
|
|
12
|
-
devs_cli-3.2.
|
|
13
|
-
devs_cli-3.2.
|
|
8
|
+
devs_cli-3.2.4.dist-info/licenses/LICENSE,sha256=bi2EUiv-lmC_quQVkNqzTYXJpjVarkPsVKfqhJl7ccQ,1067
|
|
9
|
+
devs_cli-3.2.4.dist-info/METADATA,sha256=8MW0N__JJ399B4NxvqUNUMUX1IJs9KJMQ73voTfEh7M,5282
|
|
10
|
+
devs_cli-3.2.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
11
|
+
devs_cli-3.2.4.dist-info/entry_points.txt,sha256=s8-pgqZ1QvzPJgHP9vNxwBYdezmGsFdRUHacJPZ4WOs,39
|
|
12
|
+
devs_cli-3.2.4.dist-info/top_level.txt,sha256=9RIVUPVGuOdO84qkBh_9XcKoTV7773o3py78wz2-IZk,5
|
|
13
|
+
devs_cli-3.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|