Collections
Bundle and share multiple libraries together
Collections let you bundle multiple libraries into a single installable package. They’re useful for sharing curated sets of documentation with your team or organizing related libraries together.
Creating a Collection
1. Build your libraries
First, create the individual libraries you want to include:
libragen build ./api-docs --name internal-apilibragen build ./guides --name internal-guideslibragen build ./onboarding --name onboarding-docs2. Create a collection file
Use the collection create command to bundle libraries together:
# Create with libraries specifiedlibragen collection create my-team-docs \ --library ./internal-api.libragen \ --library ./internal-guides.libragen \ --library ./onboarding-docs.libragen \ --description "Internal documentation for the team"
# Or create a template to edit manuallylibragen collection create my-team-docsThis creates a my-team-docs.json collection file. If no libraries are specified, a template is created that you can edit manually.
3. Collection file format
Collections are JSON files that reference library locations:
{ "name": "my-team-docs", "version": "1.0.0", "description": "Internal documentation for the team", "libraries": [ { "name": "internal-api", "version": "1.0.0", "description": "Internal API documentation", "url": "./internal-api.libragen" }, { "name": "internal-guides", "version": "1.0.0", "description": "Internal engineering guides", "url": "./internal-guides.libragen" } ]}Library URLs can be:
- Relative paths -
./libs/my-lib.libragen - Absolute paths -
/shared/libs/my-lib.libragen - HTTP URLs -
https://internal.example.com/libs/my-lib.libragen
Installing from a Collection
Install all libraries from a collection at once:
# From a local collection filelibragen install --from ./my-team-docs.json
# From a URLlibragen install --from https://internal.example.com/collections/team-docs.jsonHosting Collections
For team sharing, host your collection and libraries on any file server:
Simple file share
/shared/libragen/├── collections/│ └── team-docs.json└── libraries/ ├── internal-api-1.0.0.libragen ├── internal-guides-1.0.0.libragen └── onboarding-docs-1.0.0.libragenHTTP server or S3
Upload files to any HTTP-accessible location and reference them by URL in your collection.
Managing Libraries
List installed libraries
libragen listInstall a single library
# From a local filelibragen install ./path/to/library.libragen
# From a URLlibragen install https://example.com/my-lib.libragenRemove a library
libragen uninstall my-libraryPacking Collections for Sharing
Bundle a collection and all its libraries into a single .libragen-collection file for easy distribution:
# Pack a collection into a single filelibragen collection pack ./my-team-docs.json
# Creates: my-team-docs.libragen-collectionRecipients can inspect, unpack, or install directly:
# Inspect contents without extractinglibragen inspect my-team-docs.libragen-collection
# Unpack to current directorylibragen collection unpack my-team-docs.libragen-collection
# Or install directly (extracts to temp and installs)libragen install my-team-docs.libragen-collection
# Or unpack and install in one steplibragen collection unpack my-team-docs.libragen-collection --installThis is ideal for:
- Sharing collections via email or chat
- Distributing to air-gapped environments
- Bundling documentation with project releases
Best Practices
- Version your collections - Include version numbers in collection files for reproducibility
- Use relative paths for portability - When distributing collections with libraries, use relative paths
- Pack for offline sharing - Use
collection packwhen recipients don’t have network access to your library URLs - Cache in CI - Store
.libragenfiles in your CI cache to speed up builds - Keep libraries updated - Rebuild libraries when source documentation changes