diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index 60dfe5c..9c95cc6 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -15,12 +15,22 @@ Infer the repo from `git remote -v`; `gh` does this automatically when run insid ## Labels -Two axes only, always both: +Two axes for the issues you create and manage, always both: - **Package**: `pkg:cli` or `pkg:ui`. Add both if a change spans packages. - **Type**: `type:bug` or `type:feature`. -No other labels exist. In particular, there are no dedicated triage labels — triage is handled by the GitHub Project (see below), not by labels. +These are what triage and the ready queue work from; don't invent others. +There are no dedicated triage labels — triage is the GitHub Project (below), +not a label. + +The repository also carries the `wayful:*` labels: `wayful:map`, +`wayful:step`, `wayful:goal`, `wayful:blocked`, and one `wayful:type/` +per step type. They belong to the wayful CLI, which applies them to its own +issues — this repository is itself a GitHub-backed wayful project — and reads +its records back by them. Never add a `wayful:*` label by hand, and never treat +one as an agent-facing category; leave them to the CLI. See +`skills/wayful/github-guide.md`. ## Triage: the GitHub Project diff --git a/packages/cli/src/cli/cli.test.ts b/packages/cli/src/cli/cli.test.ts index d72ad5f..da038a6 100644 --- a/packages/cli/src/cli/cli.test.ts +++ b/packages/cli/src/cli/cli.test.ts @@ -17,6 +17,14 @@ describe("project and context contracts", () => { } }); + test("describes the CLI by what it does, not by one storage backend", async () => { + const project = await temporaryDirectory(); + const result = invoke(["--help"], project); + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain("Plan and complete work on maps of steps and goals"); + expect(result.stdout).not.toContain("filesystem CLI"); + }); + test("names what was wrong with a usage mistake instead of only requesting help", async () => { const project = await temporaryDirectory(); // Every parse mistake reaches this CLI as one framework `ShowHelp` whose diff --git a/packages/cli/src/cli/root.ts b/packages/cli/src/cli/root.ts index 9efce2a..29cbdd5 100644 --- a/packages/cli/src/cli/root.ts +++ b/packages/cli/src/cli/root.ts @@ -10,5 +10,5 @@ import { projectFlag } from "@cli/flags"; */ export const wayfulRoot = Command.make("wayful").pipe( Command.withSharedFlags({ project: projectFlag }), - Command.withDescription("Wayful filesystem CLI"), + Command.withDescription("Plan and complete work on maps of steps and goals"), ); diff --git a/skills/wayful/SKILL.md b/skills/wayful/SKILL.md index 8c01ea0..744a339 100644 --- a/skills/wayful/SKILL.md +++ b/skills/wayful/SKILL.md @@ -30,20 +30,25 @@ The CLI is the primary way to interact with wayful primitives. ## Quickstart -Use the `context` command to quickly gather context for a project, map, step, or artifact. Bare `context` starts at project scope; drill into a map, then a step or an artifact, by passing a reference: +Use the `context` command to quickly gather context for a project, map, step, or artifact. Bare `context` starts at project scope; drill into a map, then a step, by passing a reference: ```sh wayful context wayful context redesign wayful context 'redesign/#3' -wayful context 'redesign/@5' ``` -With `--map`/`WAYFUL_MAP` already set, the map-qualified prefix can be dropped: +An artifact is addressed by its ref rather than a reference, so it needs a map context rather than a map-qualified prefix. With `--map`/`WAYFUL_MAP` set, that context is already there: ```sh +export WAYFUL_MAP=redesign wayful context '#3' -wayful context @5 +wayful context 'file:docs/research/interviews.md' ``` Quote or escape `#` references so the shell does not treat them as a comment. ## Create and inspect work Projects are scoped to directories. Initialize a project in its directory, then run `wayful` commands from that directory; the CLI discovers the current project by default. To operate on another project, pass its directory path with `--project`. + +## Guides + +- `cli-guide.md` — the full command surface, with runnable examples. +- `github-guide.md` — running a project whose maps, steps, and goals live in GitHub Issues. diff --git a/skills/wayful/cli-guide.md b/skills/wayful/cli-guide.md index 8ce4b0d..19cb060 100644 --- a/skills/wayful/cli-guide.md +++ b/skills/wayful/cli-guide.md @@ -32,8 +32,8 @@ For less verbose batch changes, set the project and map context with `WAYFUL_PRO ```sh export WAYFUL_PROJECT=/path/to/website-redesign export WAYFUL_MAP=redesign -wayful step update 2 --description "Produce an approved responsive proposal" -wayful step complete 2 --summary "Proposal approved" +wayful step update 17 --description "Produce an approved responsive proposal" +wayful step complete 17 --summary "Proposal approved" ``` An explicit `--project` or `--map` takes precedence over its corresponding environment variable. `wayful map next` returns steps that are currently actionable: their dependencies are satisfied and their required input artifacts are available. Treat this as guidance rather than a mandate. If the map is incomplete, add or revise steps before proceeding. @@ -76,9 +76,9 @@ wayful type list wayful type show research ``` -Add steps using a type supported by the project's or map's configuration. Give each step a concise description of the result it should achieve, rather than a rigid implementation plan. Every step also receives an automatically generated integer ID, starting at `1` and increasing for each new step. +Add steps using a type supported by the project's or map's configuration. Give each step a concise description of the result it should achieve, rather than a rigid implementation plan. The backend assigns each step an integer id when it is created, and reports it — read that id from the command's output (or from `map next` or `step show`) rather than guessing it. Backends allocate differently: under the GitHub backend a step's id is its repository-wide issue number. An id is unique within its map, stable, and increasing with creation; it is not necessarily small or contiguous. -Once a step exists, address it with a reference: a bare integer id (`1`), or `#` followed by its id or name (`#1`, `#research-users`). The bare-integer form only ever means a step id — reserve the `#` sigil for by-name addressing, since a bare name would otherwise be ambiguous with a map name. A step reference can be map-qualified with a `map/` prefix (e.g. `redesign/#1`) to address a step outside the current `--map`/`WAYFUL_MAP` context. Artifacts are addressed differently: by their ref directly (e.g. `file:docs/research/interviews.md`), never map-qualified — see "Attach artifacts and record progress" below. +Once a step exists, address it with a reference: a bare integer id (`17`), or `#` followed by its id or name (`#17`, `#research-users`). The bare-integer form only ever means a step id — reserve the `#` sigil for by-name addressing, since a bare name would otherwise be ambiguous with a map name. A step reference can be map-qualified with a `map/` prefix (e.g. `redesign/#17`) to address a step outside the current `--map`/`WAYFUL_MAP` context. Artifacts are addressed differently: by their ref directly (e.g. `file:docs/research/interviews.md`), never map-qualified — see "Attach artifacts and record progress" below. ```sh wayful step create research-users \ @@ -95,10 +95,10 @@ wayful step create design-proposal \ wayful step depends #design-proposal --map redesign --on #research-users ``` -For example, if `research-users` has ID `1` and `design-proposal` has ID `2`, the dependency can also be expressed with bare ids: +For example, if `research-users` was assigned id `17` and `design-proposal` id `23`, the dependency can also be expressed with bare ids: ```sh -wayful step depends 2 --map redesign --on 1 +wayful step depends 23 --map redesign --on 17 ``` Use dependencies to express ordering or prerequisites, not to force the entire future path up front. As work reveals new needs, create a new step, change a dependency, or retire a step that is no longer useful: diff --git a/skills/wayful/github-guide.md b/skills/wayful/github-guide.md new file mode 100644 index 0000000..e1fbff4 --- /dev/null +++ b/skills/wayful/github-guide.md @@ -0,0 +1,155 @@ +# The GitHub backend + +A wayful project normally keeps its maps on disk. The GitHub backend keeps the +maps, steps, and goals in a repository's Issues instead, so they are visible, +commentable, and linkable where the rest of the project already is. Project +configuration and step-type files still live on disk in `.wayful/`; only the map +data moves. + +Read this beside `cli-guide.md`, which covers the commands themselves. + +## Initialise a GitHub-backed project + +Run `init` once, from the repository to use: + +```sh +wayful init --backend github +``` + +The repository and host come from the `origin` remote, or pass +`--repo owner/name` for the repository. `init` verifies the credential can +write, creates the `wayful:*` labels, and records the backend and repository in +`.wayful/project.toml`. If a `.wayful/` project already exists it refuses to +overwrite it. + +## Credentials + +A token for the project's host is resolved in this order, first match wins: + +1. `WAYFUL_GITHUB_TOKEN` +2. `GH_TOKEN` +3. `GITHUB_TOKEN` +4. `gh auth token --hostname `, when the `gh` CLI is signed in + +An environment variable always beats the `gh` CLI, so one command can use a +different token without disturbing the rest. The token needs write access: a +token that can read but not write is reported as an access problem, not a +missing credential. When nothing resolves, the error says to run +`gh auth login` or set `GH_TOKEN`. + +## Recognising a wayful record + +A wayful record is a GitHub issue carrying one of its labels. Project-wide +commands only read labelled issues, so a repository can keep using Issues for +human work without wayful seeing it. + +| Record | Label | What it looks like | +| --- | --- | --- | +| Map | `wayful:map` | Its title is the map's *start* text; its name lives in the body block. | +| Step | `wayful:step` | Also wears `wayful:type/` for its type and `wayful:blocked` while blocked; its title is its description. | +| Goal | `wayful:goal` | Its title is its description; like a step, its name is in the body block. | + +A map's steps and goals are **sub-issues** of the map's issue. That is what +makes them parts of that map rather than unrelated issues. + +## Ids are allocated by the backend + +A step's id under this backend is its **repository-wide issue number**. It is +not a small counter and does not start at `1`. GitHub assigns it when the issue +is created, and the CLI prints it: + +``` +$ wayful step create research-users --map redesign --type research --description "..." +Created step 74 'research-users'. +``` + +Read the id from that output — or from `wayful map next`, `wayful step show`, or +`wayful context` — and use it afterwards. Never guess it: a made-up number +addresses a different issue, or an unrelated one that shares the repository's +numbering. + +```sh +wayful step show 74 --map redesign +wayful step depends 75 --map redesign --on 74 +``` + +## Steps and goals share one sub-issue budget + +GitHub allows at most **100 sub-issues per parent issue**, and a map's steps +and goals are all sub-issues of its map issue. Steps and goals therefore share a +single budget of 100 per map, not 100 each. `step create` and `goal add` fail +with an explicit message once the map is full. A map that large is usually a +sign it should be split. + +## Keep the label set in sync + +`init` creates the primitive labels. The per-type labels follow the step-type +files, which are hand-maintained and can gain a member at any time, so after +adding, renaming, or removing a type, reconcile the repository: + +```sh +wayful label sync +``` + +It creates whatever is missing and leaves existing labels alone; safe to run +whenever. + +## Leave the structured data block alone + +Wayful writes each issue as human prose followed by a collapsed block: + +````md +Release criteria and stakeholder context. + +
+Wayful data + +```yaml +format_version: 4 +name: redesign +``` + +
+```` + +The prose above the block is yours — comment, edit it, change labels. The block +holds the fields GitHub has no native home for. Edit it by hand and the record +becomes unreadable: commands report that issue by number rather than guess. So +leave the block intact. + +## What to expect for latency + +The filesystem backend is local and effectively instant. This backend talks to +the GitHub API, so every command takes at least a network round trip and can be +noticeably slower: + +- A **single-map read** (metadata, steps, goals, attachments) is a handful of + requests at most; unchanged data is revalidated rather than re-downloaded. +- A **project-wide read** such as `map list` or project-scope `context` touches + the repository's map issues and grows with the number of maps. +- A **write** makes one or more requests, because a single change may update an + issue, its labels, and its parent. + +Avoid tight polling. GitHub rate-limits requests, and wayful stops before +exhausting the budget with a message saying when it resets — if you see it, +wait rather than retry. + +## Recent activity is issue activity + +`context` reports a map's recent activity from each issue's last-updated +timestamp. Here that timestamp moves on **any** activity on the issue — a +comment, a label change, a close — not only when wayful writes. A human +commenting on a step makes it look recently active. Read the window as "what +happened on these issues lately", not as a log of wayful commands. + +## Sharing a repository with human work + +- Wayful reads and writes only issues carrying its labels; project reads ignore + everything else. +- Step ids are ordinary repository issue numbers, shared with human issues, so + `#74` may be a wayful step or a human bug — check the labels. +- A map's steps and goals are its sub-issues. Don't attach unrelated issues to + a wayful map, and don't put wayful labels on human issues. +- These are real issues, so normal GitHub workflows apply: comment on a step, + close it with a pull request (`Closes #74`), or move it between projects. + wayful treats GitHub's own state as authoritative.