Techdocs
@cachehit/techdocsv2026.10.23.1
01README
Search and AI context building for a Hugo documentation site (Docsy or any other theme), read from its source repository in GitLab or a local checkout. It doesn't need access to the published site, so it also works for sites behind single sign-on.
sync downloads the content directory as one archive. It parses YAML or
TOML front matter and splits each page into sections at H1/H2 headings.
Drafts, exclude_search: true pages and unrendered pages are left out.
Links follow Hugo's URL rules: pretty or uglyURLs, url and slug front
matter, and custom output formats. The other methods re-sync on their own
when the branch head has moved.
Quick Start
swamp extension pull @cachehit/techdocs
# Store a GitLab token with read_repository scope (prompts for the value)
swamp vault create local_encryption docs # once, if you have no vault yet
swamp vault put docs GITLAB_TOKEN
swamp model create @cachehit/techdocs docs \
--global-arg siteUrl=https://docs.example.com \
--global-arg host=gitlab.example.com \
--global-arg project=group/docs \
--global-arg 'token=${{ vault.get("docs", "GITLAB_TOKEN") }}'
swamp model method run docs search --input query="rollback a deployment"
swamp model method run docs build_context --input query="on-call handover"Methods
- sync: download and index every content page now.
- search: ranked full-text search with typo tolerance. Returns the best-matching section of each page, with a deep link and snippet. Filters by path prefix, path substring and taxonomy terms.
- get_doc: fetch one page by content path, site URL or alias, or a single section of it. Includes the edit link and related pages.
- build_context: bundle the best-matching sections, each with its source link, into Markdown within a token budget, for AI agents.
02Behaviors
@cachehit/techdocsv2026.10.23.1techdocs/techdocs.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| siteUrl | string | Published site root, for example https://docs.example.com |
| host? | string | GitLab host name without scheme, for example gitlab.example.com |
| project? | string | GitLab project path (group/project) or numeric ID |
| ref? | string | Branch, tag or commit |
| token? | string | GitLab token with read_repository or read_api scope; use ${{ vault.get("<vault>", "<KEY>") }} |
| localPath? | string | Read a local checkout instead of GitLab (host, project and token are then unused) |
| contentDir? | string | Hugo content directory, relative to the repository root |
| uglyUrls? | boolean | Set to match the site's Hugo uglyURLs setting |
| taxonomies? | array | Front matter keys to index and filter on as taxonomies |
| outputFormats? | record | Custom Hugo output formats used as a page\ |
fn sync()
Download and index all content pages now
fn search(query: string, limit?: number)
Ranked full-text search; returns the best-matching section of each page
| Argument | Type | Description |
|---|---|---|
| query | string | |
| limit? | number |
fn get_doc(page: string, section?: string)
Fetch one page by content path, site URL or alias, optionally one section
| Argument | Type | Description |
|---|---|---|
| page | string | Content path (guides/setup.md), site URL or path (/guides/setup/), or alias |
| section? | string | H1/H2 heading text or anchor; defaults to the URL fragment, if any |
fn build_context(query: string, maxTokens?: number, maxSections?: number)
Bundle the best-matching sections, with citations, into Markdown within a token budget
| Argument | Type | Description |
|---|---|---|
| query | string | |
| maxTokens? | number | |
| maxSections? | number |
Resources
index(infinite)— Sync summary: source commit, counts, skipped files, page list
corpus(infinite)— Parsed pages and heading sections used by the other methods
search(infinite)— Latest search results, one hit per page
doc(infinite)— Latest page fetched with get_doc
context(infinite)— Latest context bundle: cited Markdown sections for an AI agent
03Stats
A
100 / 100
Downloads
4
Archive size
59.3 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned
Repository
https://github.com/zWaR/swamp-extensions04Platforms
05Labels