Skip to content

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

Merged
FreshlyBrewedCode merged 2 commits into
mainfrom
fix/79-project-host
Sep 13, 2026
Merged

FreshlyBrewedCode merged 2 commits into
mainfrom
fix/79-project-host

Conversation

@FreshlyBrewedCode

Copy link
Copy Markdown
Owner

Closes #79.

A GitHub-backed project now always talks to the repository and host it was initialised against, no matter which directory the CLI is invoked from. --project is the flag agents use, so this lands squarely on the agent path.

What changed

  • Host travels with the project. wayful init --backend github records the resolved host in project.toml (host is a new optional key; format_version is unchanged). Reads resolve the host from the project: the recorded host wins, and a project that predates the key falls back to the git remote resolved in the project root — never the process working directory — then to github.com.
  • init is safe to repeat. It checks for existing local state before resolving credentials, verifying access, or creating labels, so a repeat run no longer touches the remote and then fails.
  • init says what it bound to. It now reports the backend and, for GitHub, the repository and host.
  • wayful doctor. One command resolves the repository, host, credential source, wayful label set, and current rate-limit budget, and names whichever piece is wrong. Filesystem projects report what applies without failing for absent GitHub configuration.

User-facing change (changelog)

Command Before After
wayful --project <github project> map list from an unrelated checkout / non-git dir wrong host → bogus sign-in error lists the project's maps
wayful init --backend github where a project already exists verifies access + creates labels first, then fails Wayful state already exists; refusing to overwrite it. (remote untouched)
wayful init output Initialized Wayful project. names backend, repository, and host
wayful doctor (GitHub) did not exist repository, host, credential source, labels, rate-limit budget
wayful doctor (filesystem) did not exist reports backend without failing for absent GitHub config
Before / after examples

init bound to an enterprise host, invoked from an unrelated checkout whose origin is github.com:

Before:

$ wayful --project ~/work/enterprise-app map list
wayful: run 'gh auth login', or set GH_TOKEN

After:

$ wayful --project ~/work/enterprise-app map list
redesign
platform-migration

init --backend github in a directory that already holds a project:

Before:

$ wayful init --backend github --repo acme/widgets
wayful: run 'gh auth login', or set GH_TOKEN
# (access was verified and labels were created on the remote before this failed)

After:

$ wayful init --backend github --repo acme/widgets
wayful: Wayful state already exists; refusing to overwrite it.

init reporting what it bound to:

Before:

$ wayful init --backend github --repo acme/widgets
Initialized Wayful project.

After:

$ wayful init --backend github --repo acme/widgets
Initialized Wayful project (backend: github, repository: acme/widgets, host: github.com) in /home/me/work/acme.

wayful doctor on a healthy GitHub-backed project:

$ wayful doctor
Project: /home/me/work/acme
Backend: github
Repository: acme/widgets
Host: github.com
Credential: GH_TOKEN
Labels: wayful:map, wayful:step, wayful:goal, wayful:blocked, wayful:type/task
Rate limit: 4999/5000 core remaining (resets at 2026-09-13T10:00:00.000Z)

wayful doctor with an unusable credential:

$ wayful doctor
Project: /home/me/work/acme
Backend: github
wayful: github credential: run 'gh auth login', or set GH_TOKEN

wayful doctor on a filesystem project:

$ wayful doctor
Project: /home/me/work/notes
Backend: filesystem
GitHub: not applicable (filesystem backend)

Validation

  • bun check (lint + typecheck + test): CLI 341 pass / 1 skip / 0 fail, UI 49 pass / 0 fail.
  • New tests cover: recorded host wins over the working-directory remote (through MapStore), fallback resolves in the project root (asserted via the git child process cwd), credential-source reporting, init refusing an existing project (and a subdirectory of one) before any remote work, the init report, and the doctor diagnosis + rendering.

…working directory

A github-backed project now records the host it was initialised against in
project.toml, alongside the repo. Reads resolve the host from the project
(recorded host, else the git remote resolved in the project root, never the
invocation directory), so `wayful --project <github project>` works from an
unrelated checkout or a non-git directory.

`wayful init` also checks for existing local state before touching the
remote, and now reports the backend, repository, and host it bound to.

Adds `wayful doctor`: resolves repository, host, credential source, wayful
labels, and the rate-limit budget for a project, or names the piece that is
wrong. Filesystem projects report what applies without failing.

Closes #79
@FreshlyBrewedCode
FreshlyBrewedCode merged commit f7a62ac into main Sep 13, 2026
2 checks passed
@FreshlyBrewedCode
FreshlyBrewedCode deleted the fix/79-project-host branch September 13, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant