Commit graph hyperhive/docs/tools/forge.md
Author SHA1 Message Date
damocles
fb9cc5635a hive-forge reaction: add --list-allowed to surface the instance's configured shortcodes 2026-08-18 13:53:27 +02:00
damocles
96a27cef3c docs: cover the reaction verb and comments --show-reactions 2026-08-18 13:53:27 +02:00
iris
6eb43ba2c5 docs(forge): fix ci-log source ordering and binary path claim 2026-08-15 12:45:22 +02:00
damocles
6a95aceedb hive-forge: add dependency verb for issue/pr blocking relationships 2026-08-15 09:44:28 +02:00
atlas
0aa9a854bc fix(forge): validate list's label + milestone filters, and paginate both
A filter value the forge cannot resolve is DISCARDED, not rejected, so a
typo does not narrow the result set -- it returns the unfiltered one.
That does not waste a query, it inverts the answer: "is anything open in
this milestone" comes back as every open issue and reads as yes, and a
duplicate check gets a list that never narrowed.

`list` now resolves both before querying. Labels reuse the write side's
resolver; the ids are discarded because this endpoint filters by name, so
resolution here is a spell-check rather than a lookup -- reusing it keeps
the message identical to the one the write side has always produced.
Milestones accept a title or an id and are checked against the ALL-state
set: filtering on a closed milestone is a normal query, and validating
against open-only would reject exactly the retrospective ones.

Both fetchers paginate. `repo_labels` asked for one page of 100 and
treated it as the population -- the inverse of the trailer bug, same
root: a valid label past the cut fails to resolve, and the error then
prints an "available labels" list that is itself truncated, so the
message argues for the typo.

`--assignee` / `--author` stay unvalidated on purpose: someone who has
left still legitimately appears on old issues, so a login that is not a
current member is not necessarily a typo.

Also drops the docs paragraph claiming unknown labels are silently
dropped on the write side; that has not been true since the resolver
landed.
2026-08-05 22:06:12 +02:00
atlas
8e690c0694 feat(forge): search + milestone filters, and a page trailer that can't lie
`list` already built its query with `q: None, milestones: None` — both
fields were on the request it was sending. So full-text search over
title and body is a flag, not a new verb, and a text match is only
useful composed with the other filters anyway.

The trailer was the real defect. It fired on `count == limit`, but the
forge clamps page size to its own `api.MAX_RESPONSE_ITEMS`: ask for 400,
get a full 50, and `50 != 400` kept it silent — suppressing the warning
in precisely the case where the truncation is invisible. It now reports
the real total from `X-Total-Count`, which the response header struct
already parsed and the call site discarded. The requested limit is not
clamped client-side: that ceiling is the remote's configuration, not
ours.
2026-08-05 18:45:17 +02:00
damocles
8db1cbd204 hive-forge: add pr edit, reusing issue edit's shared /issues endpoint 2026-08-03 01:54:28 +02:00
damocles
f034ffb9d8 hive-forge: infer active repo from cwd's git remote, demote HIVE_FORGE_REPO 2026-07-29 18:37:37 +02:00
damocles
9b29c6a172 hive-forge: lint no-reviewer checks actual requested-reviewers, not a text mention 2026-07-27 19:07:36 +02:00
damocles
abde71b0ed hive-forge: add --label to issue-create and pr-create 2026-07-27 16:19:36 +02:00
damocles
c0c8e2a2d6 hive-forge: add lint unlabeled --scope subcommand 2026-07-26 16:32:28 +02:00
müde
4a48ce5024 refactor: nix/host-modules + nix/agent-modules layout, update doc paths 2026-07-13 22:05:49 +02:00
iris
c6e97ef600 docs(forge-tools): clarify create_repo MCP tool vs repo-create CLI
Agents cannot create repos directly via their forge token (no Create
scope; push-to-create disabled). Document the two paths:
- mcp__hyperhive__create_repo (forge tool group): creates under agents/
  org via hive-c0re, adds write-collaborator access, enables branch
  protection. The standard agent path.
- hive-forge repo-create / repo-add-collaborator (CLI): use the agent's
  own token; repo lands under agent's user account or org.
2026-07-04 19:01:07 +02:00
atlas
8406a45275 feat(#1997): add prettier markdown formatter to treefmt
- .prettierrc: proseWrap=preserve (no prose reflow)
- .prettierignore: exclude hivectl-cli.md (auto-generated) + 11 docs
  with multi-line list-item continuations prettier would strip to col 0
  (CommonMark limitation in prettier's list handling)
- format 16 markdown files: cosmetic only (*→_, table alignment,
  heading normalisation) — verified no broken continuations, idempotent
2026-07-02 23:33:11 +02:00
damocles
224cb06004 rename pr verbs per review: request-review -> assign-reviewer, assign -> assign-committer 2026-07-02 22:14:29 +02:00
damocles
a97d159009 hive-forge: pr request-review verb — set/withdraw requested reviewers (closes #2153) 2026-07-02 22:14:29 +02:00
iris
3ee831ccdd docs(tools/forge): document repo-create, repo-add-collaborator, repo-labels verbs 2026-07-02 15:28:45 +02:00
iris
3036472a55 docs(tools/forge): note that comments verb includes PR review bodies
hive-forge comments on a PR now merges review bodies (the summary
text from approve / request-changes / comment reviews) into the
comment listing, fixed in 1cff77f5. The verb list inline comment and
the 'Which read verb when' table row both said 'only the comments'
which was stale. Updated both to reflect the review-body inclusion.
2026-07-02 14:15:46 +02:00
atlas
7a1ea11ec2 docs(forge): note view auto-detects + scoped issue/pr view (iris review #1996) 2026-06-28 01:29:40 +02:00
atlas
6a25898bfe docs(forge): add a 'which read verb when' selection table
Part of the #1802 hive-forge audit: the read verbs (view / issue / pr /
comments / comment-show / timeline / diff / pr-status / pr-reviews) look
overlapping but each has a distinct output shape. Add a selection table +
rule-of-thumb so agents pick the right one (esp. 'view first' to clear the
read-before-comment guard) instead of guessing. Zero blast radius — pure
docs, no verb changes (the audit concluded the CLI is structurally clean
and renames/removals aren't worth the caller breakage).
2026-06-28 01:29:40 +02:00
damocles
fce9bb8c11 feat(#1985): subscription --list to audit watched repos 2026-06-25 00:09:16 +02:00
atlas
d340c1773a fix: ci-log durable persisted-log fallback for pruned runs
ci-log drove only the live run-view streamer (POST .../runs/<n>/jobs/<j>
with logCursors), which reads the live act_runner task record. Forgejo
prunes that record once a run completes, so the streamer 500s with
'task ... resource does not exist' on quick or older runs even though
the web UI still shows the logs — the reader (argus, atlas) then had to
ask the operator to relay the error.

Add a fallback: when the streamer errors or returns no lines, download
the persisted whole-job log via the same web route the run page's view-
raw-logs link uses, .../runs/<n>/jobs/<job>/attempt/<a>/logs, keyed by
the per-repo run number with the attempt segment. It survives the task
prune. Live and recent runs keep the rich per-step streamed view; only
the pruned case takes the flat fallback (where --step can't apply). New
--attempt flag (default 1) selects the run attempt for re-runs.

Verified against a real pruned run whose streamer 500'd: the fallback
prints the full persisted log; a completed short job ends cleanly at
'Job succeeded', confirming the route returns complete logs.
2026-06-23 22:45:05 +02:00
atlas
11fb2ac0fc hive-forge: add 'reopen' verb (pr reopen / issue reopen)
hive-forge had close but no reopen, so reopening required the non-obvious
workaround 'issue edit <n> --state open'. Add a reopen verb mirroring close
(PATCH state=open), wired into both 'pr reopen' (kind-checked PR) and
'issue reopen' (kind-checked issue). Updates docs/forge.md + the subcommand
enumerations.
2026-06-23 18:35:19 +02:00
atlas
c9c59c2a1d hive-forge: ci-rerun dispatches a fresh run via workflow-dispatch API
The previous implementation POSTed Forgejo's run-page rerun web route,
which is CSRF-gated and answers a bare token POST with 404 — so the verb
never actually re-ran anything against the agent token.

Rework it to dispatch a fresh run of the workflow via the
GitHub-compatible workflow-dispatch API
(POST /repos/<o>/<r>/actions/workflows/<workflow>/dispatches {"ref":<branch>}),
which accepts a plain agent token (verified end-to-end on Forgejo 15.0.3).
A dispatched run is equivalent to the old empty-commit retrigger, minus
the commit.

The branch is resolved from exactly one of --pr (the PR head branch),
--run (branch + workflow looked up from that run in the Actions runs
list), or --branch (directly); --workflow picks the workflow file for
--pr/--branch (default ci.yml). Dispatch re-runs the whole workflow, so
the old --job single-job variant is dropped.

Also add workflow_dispatch to .forgejo/workflows/ci.yml for explicitness
(Forgejo 15.0.3 dispatches the pull_request workflow without it, but the
trigger makes the API path intent-clear and cross-version robust), remove
the now-unused Client::post_web_no_content, and update docs/tools/forge.md.
2026-06-23 14:53:11 +02:00
atlas
cd4bdf4eea feat(#1778): add hive-forge ci-rerun to re-run CI without an empty commit
When a CI run fails for a transient reason (remote-builder flap, cold-daemon
window, act_runner hiccup) the only retrigger path was an empty commit, which
litters PR history and forces a force-push to clean up. This verb POSTs the
rerun action directly.

- `ci-rerun --run <n>` re-runs all jobs of a run (run number = the `runs/<n>`
  the UI shows, same value ci-log / artifact-get take, surfaced as a CI
  context's target_url by pr-status).
- `--pr <n>` resolves the run from the PR head sha's CI status target_url.
- `--job <i>` re-runs a single job.

Forgejo exposes no REST endpoint for rerunning a run, so this rides the run
page's web routes (`<base>/<owner>/<repo>/actions/runs/<n>[/jobs/<i>]/rerun`)
via a new `Client::post_web_no_content` (web base like post_json_web, tolerates
the redirect/empty response the rerun handler returns). Mirrors ci-log's
web-route approach + auth path.

docs/tools/forge.md updated with the verb.
2026-06-23 14:53:11 +02:00
lexis
d4dd5aad3e docs(tools/forge): document read-before-comment guard + --force flag 2026-06-22 23:33:13 +02:00
atlas
dc4c5460d5 feat(#1877): restructure hive-forge into pr/issue sub-verbs
Group issue/PR operations under `pr` and `issue` parent commands
(`hive-forge pr close 42`, `issue create …`, `pr status --pr 42`) per the
operator decision — kind-namespaced verbs replace the flat surface.

- new `verbs::pr_cmd` / `verbs::issue_cmd` parent commands wrap the existing
  per-verb modules (reuse their Args + run fns) under `#[command(subcommand)]`.
- kind-validation (the win over the old generic verbs): the generics that work
  on both (view/comment/comments/close/labels/assign/timeline) call
  `assert_kind` first, so `pr close <issue>` / `issue close <pr>` are rejected
  with a 'use the other command' message. PR-only / issue-only verbs are
  kind-correct by construction. `number` exposed `pub(crate)` on the shared
  verbs so the wrappers can probe it.
- every flat kind verb (`close`, `pr-create`, `pr-status`, `issue-edit`, …)
  kept as a `#[command(hide = true)]` back-compat alias — still parses, dropped
  from --help; removed in a later sweep once usage migrates. (`pr`/`issue`
  bare-show become `pr show` / `issue show` — the names are now parents.)
- docs/tools/forge.md documents the new surface + the deprecated aliases.

cargo build/clippy/fmt clean, 54 tests pass; --help surface + alias parsing
smoke-tested.
2026-06-22 16:01:13 +02:00
damocles
2005b205e9 list: paging via --page instead of --all (token-bounded per call, per review) 2026-06-17 13:49:45 +02:00
damocles
0aef643797 hive-forge: add --all to list for full-pagination repo-wide sweeps 2026-06-17 13:49:45 +02:00
damocles
2223af1b21 hive-forge: add ci-log verb for actions job step logs (closes #1674) 2026-06-16 11:34:31 +02:00
atlas
6490fc422e feat(hive-forge): add artifact-get verb to download CI run artifacts
Forgejo 15 has no REST endpoint to download an Actions artifact — the
only path is the web UI download route, which is keyed by the run's
global id rather than the per-repo run number shown in run-page URLs.
The REST artifacts list route keys off the run number instead, so the
two can't be chained directly.

artifact-get takes the run number (what pr-status surfaces as a CI
context target_url), translates it to the global run id via the REST
runs list by matching each run's html_url tail, then GETs the web
download route with the agent's forge token. Saves the artifact zip to
a path (default /tmp/forge-artifact-<name>.zip) or streams to stdout
with -o -.

The artifact name is percent-encoded into the path. The encoder that
list already used for query-string filters is promoted to a shared
verbs::pct_encode helper so both call sites stay in sync.

Lets an agent pull a CI-built artifact (e.g. a paper PDF) into /shared
without host access.
2026-06-15 17:59:38 +02:00
atlas
9d8367bb24 feat(hive-forge): add pr-merge verb (#1670)
Adds `hive-forge pr-merge <n> [--method merge|rebase] [--keep-branch]
[--force]` wrapping POST /repos/{owner}/{repo}/pulls/{n}/merge, so agents on
the peer-review-and-merge workflow have a CLI path instead of the raw API.

- Methods: merge (default) | rebase. Squash is intentionally not offered.
- Deletes the head branch after merge unless --keep-branch.
- Safe by default: refuses unless the PR is mergeable, CI is not red, and no
  review's current verdict requests changes (latest-per-reviewer wins, so a
  later approval clears an earlier request-changes). --force overrides and
  also sets Forgejo's force_merge.
- New client helper post_no_content for the 200-empty-body merge response.
2026-06-15 11:36:17 +02:00
damocles
c103ae5f10 feat(#1399): hive-forge clone verb + pr-create --agit for no-fork PRs 2026-06-05 20:51:50 +02:00
damocles
7031f57c14 feat(#1409): hive-forge pr-status verb (mergeable, CI, reviews, last comment) 2026-06-05 19:53:20 +02:00
iris
975ffd08a2 docs(tools/forge): note pr-reviews list includes inline comments per review 2026-06-05 18:24:03 +02:00
iris
35717c7bac docs(tools/forge): add comments --tail and pr-reviews --approve/--request-changes/--comment to cheatsheet 2026-06-05 15:30:33 +02:00
damocles
d60414cde1 docs: move hive-forge cli reference to docs/tools/forge.md 2026-06-05 00:57:18 +02:00