Repo module
Source: modules/repo/.
At a glance
Section titled “At a glance”| CLI | shc repo |
| Subcommands | 5 |
| HTTP endpoints | see the route reference |
| Events emitted | see the event reference |
| Error codes | see the error code reference |
| Service classes | RepoService |
| Cross-module deps | app, doctor, health |
Source layout
Section titled “Source layout”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/CLI entry points
Section titled “CLI entry points”shc repo— manage app repositories
HTTP API
Section titled “HTTP API”Routes are listed in the generated route reference; request/response notes live in the API reference.
Events emitted
Section titled “Events emitted”Event codes, durability class, and payload shapes are listed in the generated event reference.
Errors
Section titled “Errors”Typed errors are catalogued in the error code reference with HTTP statuses and message templates.
Responsibilities
Section titled “Responsibilities”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(inservice.go) — the public API.SyncRepoandSyncAllcoordinate one or all repos; internally they dispatch tosyncGitRepo,syncFileRepo, orsyncHTTPRepodepending 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 viainjectToken.RepoCrawler(incrawler.go) — given a local directory, discovers the apps inside it. Respects.repoignore(RepoIgnoreSpec), walks the tree, parses each candidate’sapp.yaml, and emits aDiscoveredAppper 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.