SDK HTTP client factory. Builds an OpencodeClient that talks to a running closedcode server, injecting the active directory as a request header / query parameter so server-side resolution stays scoped to the caller's project.
Methods
(static) createClosedcodeClient(configopt) → {OpencodeClient}
Create a typed client for a running closedcode server.
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | <optional> | Client configuration. Properties
|
A configured client instance.
- Type:
- OpencodeClient
(inner) pick(value, fallback) → {string|undefined}
Return value unless it is just an (encoded) restatement of fallback, in which case the canonical fallback is preferred.
| Name | Type | Description |
|---|---|---|
value | string | | Candidate value (e.g. from a header). |
fallback | string | | Canonical directory value to compare against. |
The resolved value, or undefined when none is set.
- Type:
- string |
undefined
(inner) rewrite(request, directory) → {Request}
Move the x-closedcode-directory hint onto the URL as a directory query parameter for GET/HEAD requests (which cannot carry a body), then strip the header so it is not sent twice.
| Name | Type | Description |
|---|---|---|
request | Request | The outgoing fetch request. |
directory | string | | Fallback directory when the header is absent. |
The original request, or a rewritten copy carrying the directory.
- Type:
- Request