Skip to content

fix(cli): resolve the GitHub repo and host from the project, not the working directory #79

Closed

Description

@FreshlyBrewedCode

Parent

#78

What to build

A github-backed project always talks to the repository and host it was initialised against, no matter which directory the CLI is invoked from.

Today the owner/name comes from the project's configuration but the host is resolved by asking git for the origin remote of the process working directory. Running wayful --project <a github-backed project> from inside an unrelated checkout therefore resolves the wrong host, looks for a credential for that host, and reports a sign-in error that has nothing to do with the real problem. --project is precisely the flag agents use, so this is squarely on the agent path.

Record the host alongside the repository at init. Keep the current format_version — the project is in preview with no users to migrate, so a new optional key is enough. Where a project predates the key, fall back to the git remote resolved in the project root, never the working directory.

Two smaller fixes to the same command while it is open:

  • wayful init --backend github verifies access and creates labels on the remote before checking whether a project already exists locally, so a repeat run touches the remote and then fails.
  • wayful init reports only that it initialised a project, saying nothing about the backend, repository, or host it bound to.

Ships wayful doctor: one command that resolves everything a github-backed project needs and names whichever piece is wrong, so the common first-run failures stop presenting as an opaque HTTP status.

Acceptance criteria

  • From a working directory that is a git checkout whose origin points at a different host, wayful --project <github-backed project> map list lists the project's maps.
  • From a directory that is not a git repository at all, the same command succeeds.
  • wayful init --backend github in a directory that already holds a project fails without creating or modifying anything on the remote.
  • wayful init --backend github reports the backend, repository, and host it bound to.
  • wayful doctor on a healthy github-backed project reports the resolved repository, the host, where the credential came from, the wayful label set, and the current rate-limit budget, and exits 0.
  • wayful doctor with an unusable credential exits non-zero and names the credential as the problem.
  • wayful doctor on a filesystem-backed project reports what it can and does not fail for absent GitHub configuration.

Blocked by

None (can start immediately).

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg:clitype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions