{"id":13454142,"url":"https://github.com/context-labs/autodoc","last_synced_at":"2025-05-15T08:10:54.556Z","repository":{"id":147209053,"uuid":"617683109","full_name":"context-labs/autodoc","owner":"context-labs","description":"Experimental toolkit for auto-generating codebase documentation using LLMs","archived":false,"fork":false,"pushed_at":"2024-08-12T00:56:38.000Z","size":24051,"stargazers_count":2110,"open_issues_count":24,"forks_count":132,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-11T19:55:16.743Z","etag":null,"topics":["cli-tool","documentation-generator","language-model","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/context-labs.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}},"created_at":"2023-03-22T22:23:01.000Z","updated_at":"2025-04-11T05:13:27.000Z","dependencies_parsed_at":"2024-07-29T20:45:45.241Z","dependency_job_id":"a761e6c6-4ad4-4c97-b2a8-2a8290b72c43","html_url":"https://github.com/context-labs/autodoc","commit_stats":{"total_commits":83,"total_committers":9,"mean_commits":9.222222222222221,"dds":0.3012048192771084,"last_synced_commit":"f6069a735345182521997c806f6b4336458b47d8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/context-labs%2Fautodoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/context-labs%2Fautodoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/context-labs%2Fautodoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/context-labs%2Fautodoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/context-labs","download_url":"https://codeload.github.com/context-labs/autodoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301432,"owners_count":22047904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli-tool","documentation-generator","language-model","typescript"],"created_at":"2024-07-31T08:00:51.286Z","updated_at":"2025-05-15T08:10:54.529Z","avatar_url":"https://github.com/context-labs.png","language":"TypeScript","readme":"\n\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/context-labs/autodoc\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/context-labs/autodoc/master/assets/autodoc.png\" alt=\"Markdownify\" width=\"200\" style=\"border-radius:8px;\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\nAutodoc\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e⚡ Toolkit for auto-generating codebase documentation using LLMs ⚡\u003c/h4\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n\t  \u003cimg alt=\"Twitter URL\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\"\u003e\n  \u003c/a\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@context-labs/autodoc\"\u003e\n\t  \u003cimg alt=\"NPM Package\" src=\"https://badge.fury.io/js/@context-labs%2Fautodoc.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/autodoc_\"\u003e\n\t  \u003cimg alt=\"Twitter URL\" src=\"https://img.shields.io/twitter/url?label=Follow%20%40autodoc_\u0026style=social\u0026url=https%3A%2F%2Ftwitter.com%2Fautodoc_\"\u003e\n\t  \u003ca href=\"https://discord.com/invite/zpFEXXWSNg\"\u003e\n\t  \u003cimg alt=\"Discord Server\" src=\"https://dcbadge.vercel.app/api/server/zpFEXXWSNg?compact=true\u0026style=flat\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#what-is-this\"\u003eWhat is this?\u003c/a\u003e •\n  \u003ca href=\"#get-started\"\u003eGet Started\u003c/a\u003e •\n  \u003ca href=\"#community\"\u003eCommunity\u003c/a\u003e •\n  \u003ca href=\"#contributing\"\u003eContribute\u003c/a\u003e\n\u003c/p\u003e\n\n\n## What is this?\nAutodoc is a **experimental** toolkit for auto-generating codebase documentation for git repositories using Large Language Models, like [GPT-4](https://openai.com/research/gpt-4) or [Alpaca](https://github.com/ggerganov/llama.cpp). Autodoc can be [installed](#get-started) in your repo in about 5 minutes. It indexes your codebase through a depth-first traversal of all repository contents and calls an LLM to write documentation for each file and folder. These documents can be combined to describe the different components of your system and how they work together. \n\nThe generated documentation lives in your codebase, and travels where your code travels. Developers who download your code can use the `doc` command to ask questions about your codebase and get highly specific answers with reference links back to code files. \n\nIn the near future, documentation will be re-indexed as part your CI pipeline, so it is always up-to-date. If your interested in working contributing to this work, see [this issue](https://github.com/context-labs/autodoc/issues/7).\n\n\n### Status\nAutodoc is in the early stages of development. It is functional, but not ready for production use. Things may break, or not work as expected. If you're interested in working on the core Autodoc framework, please see [contributing](#contributing). We would love to have your help!\n\n### FAQs\n**Question:** I'm not getting good responses. How can I improve response quality?\n\n**Answer:** Autodoc is in the early stages of development. As such, the response quality can vary widely based on the type of project your indexing and how questions are phrased. A few tips to writing good query:\n1. Be specific with your questions. Ask things like \"What are the different components of authorization in this system?\" rather than \"explain auth\". This will help Autodoc select the right context to get the best answer for your question.\n2. Use GPT-4. GPT-4 is substantially better at understanding code compared to GPT-3.5 and this understanding carries over into writing good documentation as well. If you don't have access, sign up [here](https://openai.com/waitlist/gpt-4-api).\n\n\n### Examples\nBelow are a few examples of how Autodoc can be used. \n1. [Autodoc](https://github.com/context-labs/autodoc) - This repository contains documentation for itself, generated by Autodoc. It lives in the `.autodoc` folder. Follow the instructions [here](#querying) to learn how to query it.\n2. [TolyGPT.com](https://tolygpt.com) - TolyGPT is an Autodoc chatbot trained on the [Solana validator](https://github.com/solana-labs/solana) codebase and deployed to the web for easy access. In the near future, Autodoc will support a web version in addition to the existing CLI tool.\n\n## Get Started\n\n#### Requirements\nAutodoc requires Node v18.0.0 or greater. v19.0.0 or greater is recommended. Make sure you're running the proper version:\n\n```bash\n$ node -v\n```\n\nExample output:\n```bash\nv19.8.1\n```\n\nInstall the Autodoc CLI tool as a global NPM module:\n\n```bash\n$ npm install -g @context-labs/autodoc\n```\nThis command installs the Autodoc CLI tool that will allow you to create and query Autodoc indexes.\n\nRun `doc` to see the available commands.\n\n### Querying\nYou can query a repository that has Autodoc installed via the CLI. We'll use the Autodoc repository itself as an example to demonstrate how querying in Autodoc works, but this could be your own repository that contains an index.\n\nClone Autodoc and change directory to get started:\n\n```bash \n$ git clone https://github.com/context-labs/autodoc.git\n$ cd autodoc\n```\n\nRight now Autodoc only supports OpenAI. Make sure you have have your OpenAI API key exported in your current session:\n\n```bash\n$ export OPENAI_API_KEY=\u003cYOUR_KEY_HERE\u003e\n```\n\nTo start the Autodoc query CLI, run:\n\n```bash\n$ doc q\n```\n\nIf this is your first time running `doc q`, you'll get a screen that prompts you to select which GPT models you have access to. Select whichever is appropriate for your level of access. If you aren't sure, select the first option:\n\n\u003cimg src=\"https://raw.githubusercontent.com/context-labs/autodoc/master/assets/select-models.png\" alt=\"Markdownify\" width=\"60%\" style=\"border-radius:24px;\"\u003e\n\nYou're now ready to query documentation for the Autodoc repository:\n\n\u003cimg src=\"https://raw.githubusercontent.com/context-labs/autodoc/master/assets/query.gif\" alt=\"Markdownify\" width=\"60%\" style=\"border-radius:24px;\"\u003e\n\nThis is the core querying experience. It's very basic right now, with plenty of room of improvement. If you're interested in improving the Autodoc CLI querying experience, checkout [this issue](https://github.com/context-labs/autodoc/issues/11).\n\n### Indexing\nFollow the steps below to generate documentation for your own repository using Autodoc.\n\nChange directory into the root of your project:\n```bash\ncd $PROJECT_ROOT\n```\nMake sure your OpenAI API key is available in the current session:\n\n```bash\n$ export OPENAI_API_KEY=\u003cYOUR_KEY_HERE\u003e\n```\n\nRun the `init` command:\n```\ndoc init\n```\nYou will be prompted to enter the name of your project, GitHub url, and select which GPT models you have access to. If you aren't sure which models you have access to, select the first option. You can also specify your own GPT file/directory prompts that will be used to summarize/analyze the code repoThis command will generate an `autodoc.config.json` file in the root of your project to store the values. This file should be checked in to git.\n\n**Note:** Do not skip entering these values or indexing may not work.\n\n**Prompt Configuration:** You'll find prompt directions specified in `prompts.ts`, with some snippets customizable in the `autodoc.config.json`. The current prompts are developer focused and assume your repo is code focused. We will have more reference templates in the future.\n\nRun the `index` command:\n```bash\ndoc index\n```\n\nYou should see a screen like this:\n\n\u003cimg src=\"https://raw.githubusercontent.com/context-labs/autodoc/master/assets/index-estimate.png\" alt=\"Markdownify\" width=\"60%\" style=\"border-radius:24px;\"\u003e\n\nThis screen estimates the cost of indexing your repository. You can also access this screen via the `doc estimate` command. If you've already indexed once, then `doc index` will only reindex files that have been changed on the second go.\n\nFor every file in your project, Autodoc calculates the number of tokens in the file based on the file content. The more lines of code, the larger the number of tokens. Using this number, it determine which model it will use on per file basis, always choosing the cheapest model whose context length supports the number of tokens in the file. If you're interested in helping make model selection configurable in Autodoc, check out [this issue](https://github.com/context-labs/autodoc/issues/9).\n\n**Note:** This naive model selection strategy means that files under ~4000 tokens will be documented using GPT-3.5, which will result in less accurate documentation. **We recommend using GPT-4 8K at a minimum.** Indexing with GPT-4 results in significantly better output. You can apply for access [here](https://openai.com/waitlist/gpt-4-api).\n\nFor large projects, the cost can be several hundred dollars. View OpenAI pricing [here](https://openai.com/pricing). \n\nIn the near future, we will support self-hosted models, such as [Llama](https://github.com/facebookresearch/llama) and [Alpaca](https://github.com/tatsu-lab/stanford_alpaca). Read [this issue](https://github.com/context-labs/autodoc/issues/8) if you're interesting in contributing to this work.\n\nWhen your repository is done being indexed, you should see a screen like this:\n\n\u003cimg src=\"https://raw.githubusercontent.com/context-labs/autodoc/master/assets/index-finished.png\" alt=\"Markdownify\" width=\"60%\" style=\"border-radius:24px;\"\u003e\n\nYou can now query your application using the steps outlined in [querying](#querying).\n\n## Community\nThere is a small group of us that are working full time on Autodoc. Join us on [Discord](https://discord.gg/zpFEXXWSNg), or follow us on [Twitter](https://twitter.com/autodoc_) for updates. We'll be posting regularly and continuing to improve the Autodoc application. Want to contribute? Read below.\n\n\n## Contributing\n\nAs an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation.\n\nFor detailed information on how to contribute, see [here](.github/CONTRIBUTING.md).\n","funding_links":[],"categories":["TypeScript","CLI tools","CLIs","Tools/Products","By Industry","AI code assistants/search","Projects","typescript","⚙️ Natural Language to Code Tools","A01_文本生成_文本对话","By Language","📚 Tools","Categories","UIs"],"sub_categories":["Examples","More General Coding Assistants","Tools \u0026 Utilities","Other","大语言对话模型及数据","TypeScript","🌟 What You'll Find Here:","Continuous Documentation","Command-line(shell) interface"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontext-labs%2Fautodoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontext-labs%2Fautodoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontext-labs%2Fautodoc/lists"}