Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions docs/Implementation-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -980,25 +980,25 @@ The following must work reliably:
- [X] Path utilities

### Phase 2: Basic PWA Management
- [ ] `add` command implementation
- [ ] URL validation
- [ ] Profile directory creation
- [ ] Wrapper script generation
- [ ] Desktop file generation
- [ ] Icon handling (copy from path)
- [ ] Registry entry creation
- [ ] `list` command implementation
- [ ] Table format output
- [ ] JSON/YAML format support
- [ ] Verbose mode
- [ ] `remove` command implementation
- [ ] Safe file deletion
- [ ] Profile cleanup option
- [ ] Registry update
- [ ] Registry management
- [ ] JSON-based index
- [ ] CRUD operations
- [ ] Locking for concurrent access
- [X] `add` command implementation
- [X] URL validation
- [X] Profile directory creation
- [X] Wrapper script generation
- [X] Desktop file generation
- [X] Icon handling (copy from path)
- [X] Registry entry creation
- [X] `list` command implementation
- [X] Table format output
- [X] JSON/YAML format support
- [X] Verbose mode
- [X] `remove` command implementation
- [X] Safe file deletion
- [X] Profile cleanup option
- [X] Registry update
- [X] Registry management
- [X] JSON-based index
- [X] CRUD operations
- [X] Locking for concurrent access

### Phase 3: Browser Integration Test Framework
- [ ] Tooling setup
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ disallow_any_generics = true
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
disallow_untyped_decorators = false
warn_unused_ignores = false

[tool.pytest.ini_options]
addopts = "-q --cov=pwa_forge --cov-report=term-missing"
Expand Down
71 changes: 68 additions & 3 deletions src/pwa_forge/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import click

from pwa_forge.commands.add import AddCommandError, add_app
from pwa_forge.commands.list_apps import list_apps as list_apps_impl
from pwa_forge.commands.remove import RemoveCommandError
from pwa_forge.commands.remove import remove_app as remove_app_impl
from pwa_forge.config import load_config
from pwa_forge.utils.logger import setup_logging

Expand Down Expand Up @@ -108,7 +112,42 @@ def add(
Example:
pwa-forge add https://chat.openai.com --name ChatGPT
"""
click.echo("Add command - Not yet implemented")
config = ctx.obj["config"]

try:
result = add_app(
url=url,
config=config,
name=name,
app_id=app_id,
browser=browser,
profile=profile,
icon=icon,
out_of_scope=out_of_scope,
inject_userscript=inject_userscript,
wm_class=wm_class,
chrome_flags=chrome_flags,
dry_run=dry_run,
)

if not ctx.obj.get("no_color"):
click.secho("✓ PWA created successfully!", fg="green")
else:
click.echo("✓ PWA created successfully!")

click.echo(f" ID: {result['id']}")
click.echo(f" Name: {result['name']}")
click.echo(f" URL: {result['url']}")

if dry_run:
click.echo("\n[DRY-RUN] No changes were made.")

except AddCommandError as e:
if not ctx.obj.get("no_color"):
click.secho(f"✗ Error: {e}", fg="red", err=True)
else:
click.echo(f"✗ Error: {e}", err=True)
ctx.exit(1)


@cli.command(name="list")
Expand All @@ -122,7 +161,8 @@ def add(
@click.pass_context
def list_apps(ctx: click.Context, verbose: bool, format: str) -> None: # noqa: A002
"""List all managed PWA instances."""
click.echo("List command - Not yet implemented")
config = ctx.obj["config"]
list_apps_impl(config, verbose=verbose, output_format=format)


@cli.command()
Expand All @@ -147,7 +187,32 @@ def remove(
Example:
pwa-forge remove chatgpt
"""
click.echo("Remove command - Not yet implemented")
config = ctx.obj["config"]

try:
remove_app_impl(
app_id=id,
config=config,
remove_profile=remove_profile,
remove_icon=remove_icon,
keep_userdata=keep_userdata,
dry_run=dry_run,
)

if not ctx.obj.get("no_color"):
click.secho(f"✓ PWA removed successfully: {id}", fg="green")
else:
click.echo(f"✓ PWA removed successfully: {id}")

if dry_run:
click.echo("\n[DRY-RUN] No changes were made.")

except RemoveCommandError as e:
if not ctx.obj.get("no_color"):
click.secho(f"✗ Error: {e}", fg="red", err=True)
else:
click.echo(f"✗ Error: {e}", err=True)
ctx.exit(1)


@cli.command()
Expand Down
9 changes: 9 additions & 0 deletions src/pwa_forge/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Command implementations for PWA Forge."""

from __future__ import annotations

__all__ = ["add_app", "list_apps", "remove_app"]

from pwa_forge.commands.add import add_app
from pwa_forge.commands.list_apps import list_apps
from pwa_forge.commands.remove import remove_app
Loading