Imports:
  - Types:
      - SwaxContext
    Usages:
      - cli-facade
    From: swax/cli
  - Types:
      - run_init
    Usages:
      - init AS init-usage
    From: swax/applications
  - Types:
      - RepositoryCloneError
      - SpecsNotFoundError
    Usages:
      - specs-repository
    From: swax/git

Usages:
  conventions: .goga/usages/conventions.md
  click: .goga/usages/cooks/click.md

Annotations: |
  Thin CLI handler: prompts only and exception mapping. All orchestration lives in `run_init`.
  `RepositoryCloneError` and `SpecsNotFoundError` are mapped to click.ClickException for
  uniform exit codes.

  Use `conventions` for code writing rules and testing.
  Use `click` for the command decorator, prompts, and error mapping.
  Use `init-usage` for `run_init` semantics.
  Use `specs-repository` for `RepositoryCloneError` and `SpecsNotFoundError` semantics.
  Use `cli-facade` for the `SwaxContext` access pattern.

---

"init(ctx: click.Context)":
  location: init.py
  annotations: |
    Click handler for the init command: prompts the user, delegates to `run_init`,
    and maps domain exceptions.

    `ctx`: Click context whose obj is a `SwaxContext` carrying the env-file path.

    Algorithm:
    1. Resolve ctx.obj as `SwaxContext` via @click.pass_obj.
    2. Prompt for repo_url, specs_location, and download_path.
    3. Resolve project_root from the current working directory.
    4. Delegate to `run_init` inside a try.
    5. Map `RepositoryCloneError` and `SpecsNotFoundError` to click.ClickException.

    Requirements:
    - Prompts are the sole source of user input — no command-line options for these values.
    - Exit code 0 on success, 1 on any ClickException (Click default).

    Constraints:
    - Do not catch generic Exception — only the two domain exceptions imported above.
    - Do not log credentials — prompts collect only repo URL and paths.

---

Author: Goga
CreatedAt: 25/06/26
Description: |
  Click handler for the init command — interactive prompts and exception mapping to ClickException.
