Skip to content
SHC Docs

Repo module

Source: modules/repo/.

CLIshc repo
Subcommands5
HTTP endpointssee the route reference
Events emittedsee the event reference
Error codessee the error code reference
Service classesRepoService
Cross-module depsapp, doctor, health
modules/repo/
├── command.go
├── crawler.go
├── doctor.go
├── errors.go
├── events.go
├── metadata.go
├── models.go
├── router.go
├── service.go
├── tasks.go
├── types.go
└── commands/

Routes are listed in the generated route reference; request/response notes live in the API reference.

Event codes, durability class, and payload shapes are listed in the generated event reference.

Typed errors are catalogued in the error code reference with HTTP statuses and message templates.

The repo module owns the app catalog sync layer — taking a user-added repository URL (git, HTTP tarball, or local path), fetching its contents, discovering the apps inside it, and registering them into the AppModel table so shc search / shc install <name> can find them.

Two cooperating concerns:

  • RepoService (in service.go) — the public API. SyncRepo and SyncAll coordinate one or all repos; internally they dispatch to syncGitRepo, syncFileRepo, or syncHTTPRepo depending on URL scheme. Git repos are cloned on first sync and fetched + reset on subsequent syncs; HTTP repos are fetched as tarballs; file repos are symlinked or copied. Tokens (e.g. for private git repos) are injected safely via injectToken.
  • RepoCrawler (in crawler.go) — given a local directory, discovers the apps inside it. Respects .repoignore (RepoIgnoreSpec), walks the tree, parses each candidate’s app.yaml, and emits a DiscoveredApp per valid directory.

After discovery, registerAppsFromIndex upserts the AppModel rows, pruneOrphanedApps removes apps that vanished since the last sync, and the operation emits an event. Errors are surfaced as X404901REPNOF (unknown repo) and X500903REPSYN (sync failure).

What the repo module does not own: app.yaml schema validation (that is app via definition.go), running the apps it discovers (that is the full install pipeline in app / stack), or scheduling periodic syncs (that is schedule, plus the maintenance loop in default.yaml’s maintenance.repo_sync). This module is specifically the fetch + discover + register pipeline.