Skip to main content

Overview

OpenGround uses sources.json files to store library source configurations. This allows you to add documentation by name alone, without repeatedly specifying URLs and options.

How Sources Files Work

When you add documentation with the --source flag, OpenGround automatically saves the configuration so you can reference it by name later.
1

First time: Add with full configuration

2

Configuration is saved automatically

OpenGround saves to ~/.openground/sources.json:
3

Later: Use name only

Types of Sources Files

OpenGround supports multiple sources files with a priority system:

1. User Sources File

Location: ~/.openground/sources.json
  • Shared across all your projects
  • Created automatically when you first use --source
  • Default location for auto-saved sources

2. Project Sources File

Location: .openground/sources.json (in project directory)
  • Project-specific overrides
  • Takes priority over user sources
  • Useful for project-specific documentation versions

3. Custom Sources File

Location: Anywhere you specify
  • Specified via --sources-file flag
  • Takes highest priority
  • Useful for team-shared configurations

4. Package-Level Sources

Location: Inside OpenGround package
  • Bundled default sources
  • Lowest priority (fallback)

Priority Order

When looking up a library by name, OpenGround checks in this order:
1

1. Custom path via --sources-file

Highest priority - explicitly specified.
2

2. Project-local .openground/sources.json

Located in current directory’s .openground/ folder.Allows project-specific overrides.
3

3. User ~/.openground/sources.json

Your personal sources file.Shared across all projects.
4

4. Package-level bundled sources

Default sources included with OpenGround.Lowest priority (fallback only).

Sources File Structure

The sources.json file maps library names to their configurations:

Source Type Fields

Git Repository ("type": "git_repo")

Fields:
  • type - Must be "git_repo"
  • repo_url - Git repository URL (required)
  • docs_paths - Array of paths within repo (optional, defaults to entire repo)
  • languages - Array of programming languages (optional, metadata only)

Sitemap ("type": "sitemap")

Fields:
  • type - Must be "sitemap"
  • sitemap_url - URL to XML sitemap (required)
  • filter_keywords - Array of URL filters (optional)
  • languages - Array of programming languages (optional, metadata only)

Local Path ("type": "local_path")

Fields:
  • type - Must be "local_path"
  • local_path - Path to local directory (required)
  • languages - Array of programming languages (optional, metadata only)

Auto-Save Behavior

By default, OpenGround automatically saves sources to ~/.openground/sources.json when you use --source:

Disable Auto-Save

To disable automatic source saving:
Now sources will only be saved if you manually edit the file.

Re-enable Auto-Save

Project-Specific Overrides

Use project-local sources files to override user sources for specific projects:
1

Create project sources directory

2

Create project sources.json

3

Use in project

Custom Sources File

Share a sources file across a team:

Set Default Custom Sources

Configure OpenGround to always use a custom sources file:

Viewing Sources Files

View User Sources

View Project Sources

View Which File Is Used

When you run add with an existing source, OpenGround shows which file it’s using:

Editing Sources Files

Manual Editing

You can directly edit the JSON file:

Adding a New Source Manually

Modifying Existing Source

Examples

Team Workflow

Multi-Project Developer

Personal + Team Sources

Troubleshooting

Library Not Found

If OpenGround can’t find a library:

Wrong Source Being Used

Check the priority order:

Invalid JSON

If you get JSON parse errors:

Auto-Save Not Working

Check if auto-save is enabled:

Best Practices

  1. Use user sources for personal libraries - Keep frequently used libraries in ~/.openground/sources.json
  2. Use project sources for project-specific versions - Override in .openground/sources.json when needed
  3. Share team sources via config - Point sources.file_path to a shared location
  4. Keep sources.json in version control - Commit .openground/sources.json to share with team
  5. Document custom sources - Add comments in README about custom sources setup