Documentation
¶
Overview ¶
Package docscapture implements the browser-backed screenshot capture for the rela-docs screenshot{} island (Tier B). It stands up the data-entry SPA over a seeded temp project and drives headless Chrome (chromedp) to capture a PNG.
It is deliberately a SEPARATE package from internal/docs: it pulls in the whole data-entry + appbuild + chromedp dependency surface, which the core doc language must not carry. internal/docs depends on it only through the consumer-side docs.Capturer interface, injected by the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient implements docs.APIClient: it stands up the data-entry server over a seeded temp project and issues real HTTP requests against it.
It lives here rather than in internal/docs for the same reason the Capturer does — it pulls in dataentry + appbuild, which the core doc language must not carry. Unlike the Capturer it needs NO browser and no built frontend, so a manual using only api{} assertions runs anywhere the Go tests do.
The temp project is stood up lazily on the first request and reused, with the manual's growing seed applied incrementally (see project.syncSeed): a manual creates entities as it goes, so a later api{} must see entities created after the server started.
Nil: never returned by New; the zero value is not usable — use NewAPIClient.
func NewAPIClient ¶
NewAPIClient returns a client serving the given project.
func (*APIClient) Do ¶
func (c *APIClient) Do(ctx context.Context, req docs.APIRequest) (docs.APIResponse, error)
Do issues one request, standing the server up on first use.
An HTTP error status is a normal return, not an error: asserting a 403 or a 404 is the point of the verb. Only a transport-level failure errors.
type Capturer ¶
type Capturer struct {
// contains filtered or unexported fields
}
Capturer implements docs.Capturer using chromedp against a data-entry SPA served over a seeded temp project. The temp project + server + browser are created lazily on the first Capture and reused across islands; Close tears them all down.
func New ¶
New returns a Capturer. It does NOT launch a browser yet (that happens on the first Capture) so a manual with no screenshot{} pays nothing. It DOES verify a Chrome binary is resolvable, so a screenshot-bearing manual fails loud early rather than after standing up a server.