{"id":49203314,"url":"https://github.com/jctosta/locadoc","last_synced_at":"2026-04-23T17:00:27.165Z","repository":{"id":353368481,"uuid":"1219119176","full_name":"jctosta/locadoc","owner":"jctosta","description":"Search and read devdocs.io documentation from the terminal. Offline-first, JSON-native, and built for both humans and AI agents. Bun + TypeScript.","archived":false,"fork":false,"pushed_at":"2026-04-23T16:31:41.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T17:00:13.939Z","etag":null,"topics":["ai-tools","bun","cli","devdocs","developer-tools","documentation","llm-tools","offline-docs","terminal","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jctosta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T14:48:31.000Z","updated_at":"2026-04-23T16:31:42.000Z","dependencies_parsed_at":"2026-04-23T17:00:20.921Z","dependency_job_id":null,"html_url":"https://github.com/jctosta/locadoc","commit_stats":null,"previous_names":["jctosta/locadoc"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jctosta/locadoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jctosta%2Flocadoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jctosta%2Flocadoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jctosta%2Flocadoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jctosta%2Flocadoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jctosta","download_url":"https://codeload.github.com/jctosta/locadoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jctosta%2Flocadoc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32189656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T15:28:30.493Z","status":"ssl_error","status_checked_at":"2026-04-23T15:28:29.972Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","bun","cli","devdocs","developer-tools","documentation","llm-tools","offline-docs","terminal","typescript"],"created_at":"2026-04-23T17:00:16.747Z","updated_at":"2026-04-23T17:00:27.148Z","avatar_url":"https://github.com/jctosta.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# locadoc\n\nCLI for [devdocs.io](https://devdocs.io) content — search and read development documentation from the terminal or from automated workflows (scripts, LLM tool-use loops, editor integrations).\n\nDocsets are downloaded once, stored under `$LOCADOC_HOME`, and searched with the same scoring algorithm devdocs.io uses in-browser.\n\n## Demo\n\n[![asciicast](https://asciinema.org/a/30n5kUWu4IUf0tDt.svg)](https://asciinema.org/a/30n5kUWu4IUf0tDt)\n\nPrefer a local replay? The raw asciicast is checked in:\n\n```sh\nasciinema play docs/demo.cast           # replay at recorded speed\nasciinema play -s 2 docs/demo.cast      # 2× speed\nbash scripts/demo.sh                     # run the demo live against your locadoc install\n```\n\n\u003e **AI-assisted project.** This codebase was designed and implemented collaboratively with an AI coding agent (Claude Code). The initial research, architecture decisions, and full implementation were produced in a single session from the prompt below. Review the source before depending on it in production.\n\u003e\n\u003e **Original prompt:**\n\u003e \u003e I want to create a cli powered version of devdocs.io, to allow searching and fetching development documents directly from the terminal or piped in automated workflows. We can use https://github.com/toiletbril/dedoc as reference, but I don't want to make a carbon copy of the codebase, the idea is to keep things simple and make the tool AI friendly. Look into devdocs repository as well if needed (https://github.com/freeCodeCamp/devdocs).\n\n## Install\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/jctosta/locadoc/main/install.sh | bash\n```\n\nGrabs the right prebuilt binary for your OS/arch from [GitHub Releases](https://github.com/jctosta/locadoc/releases), verifies its SHA-256, and drops `locadoc` into `~/.local/bin`. macOS and Linux (x64 and arm64) are supported.\n\nEnv overrides:\n\n| Variable | Default | Purpose |\n|---|---|---|\n| `PREFIX` | `$HOME/.local/bin` | install directory (e.g. `PREFIX=/usr/local/bin sudo bash install.sh`) |\n| `LOCADOC_VERSION` | `latest` | pin a specific release tag (e.g. `LOCADOC_VERSION=v0.1.0`) |\n\nIf `$PREFIX` isn't on your `PATH`, the installer prints a one-liner to add to your shell rc.\n\nFor Windows, download the binary directly from [the latest release](https://github.com/jctosta/locadoc/releases/latest).\n\n## Install from source\n\n```sh\nbun install\nbun link            # exposes `locadoc` as a global command\n```\n\nOr run without linking:\n\n```sh\nbun run src/cli.ts \u003ccommand\u003e\n```\n\n## Getting started\n\n```sh\nlocadoc docs                       # fetch the manifest of available docsets\nlocadoc ls --all | head            # browse what's available\nlocadoc download bun react         # install one or more docsets\nlocadoc ls                         # see what's installed\nlocadoc search useEffect           # search across all installed docsets\nlocadoc read react reference/react/useeffect\n```\n\nPage paths come from the `path` column of `search` output — don't guess them. They map directly to keys in the docset's `db.json`.\n\n## Output modes\n\nlocadoc is TTY-aware. Pretty output goes to a terminal, JSON goes to a pipe:\n\n```sh\nlocadoc search useEffect                    # human-friendly table\nlocadoc search useEffect | jq '.[0]'        # structured JSON\n```\n\nForce either explicitly:\n\n```sh\nlocadoc search useEffect --json\nlocadoc ls --all --text\n```\n\nSet `NO_COLOR=1` to disable ANSI styling.\n\n## Commands\n\n### `locadoc docs [--refresh]`\n\nFetch the manifest of available docsets from `https://devdocs.io/docs.json`. Cached for 24h; use `--refresh` to force re-fetch.\n\n### `locadoc ls [--all]`\n\nDefault: list installed docsets. `--all` lists everything in the manifest (requires `locadoc docs` first).\n\n### `locadoc download \u003cslug\u003e...`\n\nInstall one or more docsets. Fetches `{slug}.tar.gz` from `downloads.devdocs.io` and falls back to the per-file JSON endpoints on `documents.devdocs.io` if the tarball is missing.\n\n### `locadoc update [\u003cslug\u003e...]`\n\nRe-download docsets whose `mtime` is older than the manifest. With no args, updates everything installed.\n\n### `locadoc remove \u003cslug\u003e...`\n\nDelete docsets from disk and the registry.\n\n### `locadoc search [--docset \u003cslug\u003e] [--type \u003ct\u003e] [--limit N] \u003cquery\u003e`\n\nSearch installed docsets. Scoring is a port of devdocs' `searcher.js`: exact substring first, then fuzzy regex for queries ≥ 3 chars. Without `--docset`, searches across every installed docset.\n\n### `locadoc read \u003cslug\u003e \u003cpath\u003e[#fragment] [--format md|ansi|html|raw]`\n\nRender a docset page. Paths come from `search` output. Fragments slice the HTML to a heading and its siblings.\n\n`--format` defaults:\n- `ansi` when stdout is a TTY\n- `md` when piped or `--json` is set\n- `raw` returns the untouched HTML; `html` returns the stripped/sliced HTML\n\n## JSON schemas\n\nStable shapes, safe to consume from scripts / LLM tool calls.\n\n**`ls` / `ls --all`** — `LsRow[]`:\n```ts\n{ slug, name, version?, release?, mtime, installed, stale }\n```\n\n**`search`** — `SearchResult[]`:\n```ts\n{ docset, name, path, type, score }\n```\n\n**`read`** — `ReadResult`:\n```ts\n{ docset, path, fragment?, title, markdown, attribution? }\n```\n\n**`docs`** — `{ count, cachedAt, path }`\n\n**`download` / `remove`** — per-slug status records.\n\n## Exit codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | Success |\n| 1 | Not found (docset, page, search results) |\n| 2 | Usage error |\n| 3 | Network error |\n| 4 | Storage error |\n\n## Storage\n\n```\n$LOCADOC_HOME (default: ~/.locadoc/)\n├── manifest.json      # cached docs.json\n├── docsets/\u003cslug\u003e/    # index.json, db.json, meta.json (+ html assets)\n└── locadoc.db         # SQLite: installed docsets + flattened entries index\n```\n\nSet `LOCADOC_HOME` or pass `--home \u003cpath\u003e` to relocate.\n\n## AI / automation usage\n\nlocadoc is designed to be called from LLM tool loops and scripts.\n\n```sh\n# Find a page, then read it, all as JSON\nlocadoc search 'promise.all' --json --limit 1 \\\n  | jq -r '.[0] | \"\\(.docset) \\(.path)\"' \\\n  | xargs -n2 locadoc read --json \\\n  | jq -r '.markdown'\n```\n\n- `--json` / `--text` force the output format independent of TTY state.\n- `--quiet` silences stderr progress.\n- Schemas are stable — only additive changes within `0.x`.\n- No prompts, no spinners when piped.\n\n## Use with Claude Code\n\nlocadoc ships with a [Claude Code skill](https://docs.claude.com/en/docs/claude-code/skills) that teaches the model when and how to reach for locadoc. Install it once and any future Claude Code session picks it up automatically:\n\n```sh\nlocadoc skill install                # writes ~/.claude/skills/locadoc/SKILL.md\nlocadoc skill install --project      # ./.claude/skills/locadoc/SKILL.md (this project only)\nlocadoc skill install --force        # overwrite existing\nlocadoc skill install --dry-run      # preview without writing\nlocadoc skill where                  # print the target path\nlocadoc skill show                   # dump the embedded SKILL.md\nlocadoc skill uninstall              # remove it\n```\n\nThe skill auto-triggers on API / library documentation questions (e.g. *\"how does useEffect work\"*, *\"signature of Array.prototype.reduce\"*) and includes `allowed-tools: Bash(locadoc:*)` so Claude doesn't need to ask for permission on every invocation.\n\nJSON schemas (stable within `0.x`):\n\n- `install` / `uninstall` / dry-run → `{ scope, path, action, bytes? }` where `action ∈ {installed, updated, skipped, removed, absent, dry-run}`.\n- `where` → `{ scope, path, exists }`.\n- `show` → raw SKILL.md to stdout (no wrapper).\n\nThe SKILL.md content is embedded in the compiled binary via Bun's text-import — installing works offline and is version-locked to your locadoc binary. Update the skill by re-running `locadoc skill install --force` after upgrading.\n\n## License and attribution\n\nlocadoc is released under the [MIT License](./LICENSE), with one exception: `src/searcher.ts` is a TypeScript port of [devdocs.io](https://devdocs.io)'s `assets/javascripts/app/searcher.js` and remains under the Mozilla Public License 2.0 per MPL's file-level copyleft.\n\nDocumentation content fetched at runtime is © its respective upstream authors, aggregated by [devdocs.io](https://devdocs.io) under MPL 2.0. This project does not redistribute docset content; it downloads it on demand from the public devdocs CDN.\n\n[dedoc](https://github.com/toiletbril/dedoc) (GPL-3.0) by toiletbril served as a reference for the command surface and storage model — no code was copied from it. locadoc is an independent Bun/TypeScript implementation with different design goals (TTY-aware JSON output, Markdown rendering, AI tool-use friendly schemas).\n\n## Development\n\n```sh\nbun test                    # run the test suite\nbunx tsc --noEmit           # typecheck\nLOCADOC_HOME=/tmp/x bun run src/cli.ts docs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjctosta%2Flocadoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjctosta%2Flocadoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjctosta%2Flocadoc/lists"}