{"id":43727240,"url":"https://github.com/igorrius/flatten-go-doc","last_synced_at":"2026-02-05T09:10:15.888Z","repository":{"id":329267393,"uuid":"1118847256","full_name":"igorrius/flatten-go-doc","owner":"igorrius","description":"CLI tool and Go library to scrape and flatten pkg.go.dev documentation into a single Markdown file for offline use and LLM context.","archived":false,"fork":false,"pushed_at":"2025-12-18T15:42:41.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T17:51:23.329Z","etag":null,"topics":["cli","dev-tools","documentation","go","golang","markdown","notebooklm","pkg-go-dev","scraper"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igorrius.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":"2025-12-18T11:12:49.000Z","updated_at":"2025-12-18T14:57:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/igorrius/flatten-go-doc","commit_stats":null,"previous_names":["igorrius/flatten-go-doc"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/igorrius/flatten-go-doc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorrius%2Fflatten-go-doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorrius%2Fflatten-go-doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorrius%2Fflatten-go-doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorrius%2Fflatten-go-doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igorrius","download_url":"https://codeload.github.com/igorrius/flatten-go-doc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorrius%2Fflatten-go-doc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29117920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"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":["cli","dev-tools","documentation","go","golang","markdown","notebooklm","pkg-go-dev","scraper"],"created_at":"2026-02-05T09:10:15.278Z","updated_at":"2026-02-05T09:10:15.879Z","avatar_url":"https://github.com/igorrius.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flatten Go Doc\n\n`flatten-go-doc` is a CLI tool that scrapes Go package documentation from `pkg.go.dev` and consolidates it into a single, easy-to-read Markdown file. Perfect for offline reading or providing context to LLMs.\n\n## Features\n\n-   **GitHub URL Support**: Accepts GitHub repository URLs directly (e.g., `https://github.com/user/repo`) and resolves them to `pkg.go.dev`.\n-   **Source File Downloading**: Automatically identifies and downloads raw Go source files linked in the documentation, appending them to the output for full context.\n-   **Retry Logic**: Robust scraping with automatic retries and exponential backoff for transient network issues.\n-   **Recursive Scraping**: Automatically finds and scrapes sub-packages.\n-   **Markdown Conversion**: Converts documentation and READMEs into clean Markdown.\n-   **Sorted Output**: Organizes documentation alphabetically by package URL.\n-   **SOLID Architecture**: Refactored into modular components (Scraper, Converter, Source Handler) for better maintainability and extensibility.\n\n## Installation\n\n### Using `go install`\n\nYou can install `flatten-go-doc` directly to your `$GOPATH/bin`:\n\n```bash\ngo install github.com/igorrius/flatten-go-doc@latest\n```\n\n### From Source\n\n1.  Clone the repository:\n    ```bash\n    git clone https://github.com/igorrius/flatten-go-doc.git\n    cd flatten-go-doc\n    ```\n2.  Install locally:\n    ```bash\n    go install .\n    ```\n\n## Usage\n\nThe tool takes the `pkg.go.dev` URL or a GitHub repository URL as the first argument. An optional output file path can be provided as the second argument.\n\n```bash\nflatten-go-doc \u003cPKG_GO_DEV_URL | GITHUB_URL\u003e [OUTPUT_FILE]\n```\n\n### Examples\n\n**Basic usage (outputs to `\u003cpackage_name_sanitized\u003e.md`):**\n```bash\ngo run . https://pkg.go.dev/github.com/google/go-cmp/cmp\n# Creates: github.com_google_go-cmp_cmp.md\n```\n\n**Using a GitHub URL:**\n```bash\ngo run . https://github.com/google/go-cmp\n# Resolves to pkg.go.dev and creates: github.com_google_go-cmp.md\n```\n\n**Specifying an output file:**\n```bash\nflatten-doc https://pkg.go.dev/github.com/google/go-cmp/cmp my-docs.md\n```\n\n## Library Usage\n\nYou can also use the scraper as a library in your own Go projects:\n\n```go\nimport \"github.com/igorrius/flatten-go-doc/pkg/flattener\"\n\nfunc main() {\n    config := flattener.DefaultConfig()\n    f := flattener.New(config)\n    results, err := f.Flatten(\"https://pkg.go.dev/some/package\")\n    // ... handle results\n}\n```\n\n## Tip: Using with NotebookLM\n\n`flatten-go-doc` is an excellent companion for Google **NotebookLM**. By consolidating documentation and source code into a single Markdown file, you can:\n\n1.  **Full Library Context**: Upload the generated `.md` file as a source in NotebookLM.\n2.  **AI-Powered Guidance**: Ask NotebookLM to \"explain how to use this library based on the source code\" or \"create a tutorial for [specific feature]\".\n3.  **Code Synthesis**: Since the tool includes the actual `.go` source files, NotebookLM can reason about the implementation details that aren't always visible in the standard documentation, helping you write more accurate and idiomatic code.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorrius%2Fflatten-go-doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figorrius%2Fflatten-go-doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorrius%2Fflatten-go-doc/lists"}