# siyuan-note/bazaar architecture

> Architecture diagram of the GitHub repository siyuan-note/bazaar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siyuan-note/bazaar
- Repository: https://github.com/siyuan-note/bazaar

## Overview

SiYuan Bazaar maintains community package listings, validates pull-request changes, stages package releases into client-facing indexes, and publishes index artifacts. The principal workflow runs from a package-list PR through package/release validation and review, then—after merge—scheduled staging and index publication. Separate branches support incremental staging, deprecation metadata, and archived-repository audits. The excerpts show selected calls; other links below are documented by the README, while unsampled implementation details are not inferred.

Main entry points: [`actions/check/main.go`](https://github.com/siyuan-note/bazaar/blob/main/actions/check/main.go) (PR check), [`actions/stage/main.go`](https://github.com/siyuan-note/bazaar/blob/main/actions/stage/main.go) (Stage runner), [`rules/manifest.go`](https://github.com/siyuan-note/bazaar/blob/main/rules/manifest.go) (Package rules), [`actions/index/main.go`](https://github.com/siyuan-note/bazaar/blob/main/actions/index/main.go) (Index publisher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_review["PR review"]
  node_prcheck["PR check<br/>[main.go]"]
  node_prselect["PR scheduling<br/>[select.go]"]
  node_checkmeta["Check metadata<br/>[meta.go]"]
  node_labels["PR labels<br/>[label.go]"]
end

subgraph group_validation["Package validation"]
  node_release["Release lookup<br/>[release.go]"]
  node_rules["Package rules<br/>[manifest.go]"]
  node_filechecks["Package file checks<br/>[files.go]"]
  node_deprecation["Deprecation registry<br/>[deprecated.go]"]
end

subgraph group_staging["Index staging"]
  node_stage["Stage runner<br/>[main.go]"]
  node_incremental["Incremental planning<br/>[incremental.go]"]
  node_packageindex["Package indexing<br/>[index.go]"]
  node_stagereport["Stage reporting<br/>[report.go]"]
  node_indexpublish["Index publisher<br/>[main.go]"]
end

subgraph group_operations["Bazaar operations"]
  node_archiveaudit["Archived repo audit<br/>[main.go]"]
end

node_contributor(("Package contributor"))
node_github["GitHub"]
node_bazaarstorage[("Object storage")]
node_rhythm["Rhy service"]

node_contributor -->|"opens PR"| node_prcheck
node_prselect -->|"schedules checks"| node_prcheck
node_prcheck -->|"checks PR"| node_github
node_prcheck -->|"fetches release"| node_release
node_prcheck -->|"validates package"| node_rules
node_rules -.->|"checks files"| node_filechecks
node_prcheck -->|"syncs labels"| node_labels
node_prcheck -.->|"records check state"| node_checkmeta
node_stage -.->|"plans updates"| node_incremental
node_stage -->|"stages packages"| node_packageindex
node_packageindex -->|"validates package"| node_rules
node_stage -->|"fetches releases"| node_release
node_stage -->|"applies deprecations"| node_deprecation
node_stage -.->|"reports failures"| node_stagereport
node_stage -.->|"writes staged data"| node_bazaarstorage
node_indexpublish -->|"uploads indexes"| node_bazaarstorage
node_indexpublish -->|"reports index hash"| node_rhythm
node_archiveaudit -->|"queries repository state"| node_github
node_archiveaudit -->|"reads registry"| node_deprecation

click node_prcheck "https://github.com/siyuan-note/bazaar/blob/main/actions/check/main.go"
click node_prselect "https://github.com/siyuan-note/bazaar/blob/main/actions/check/select.go"
click node_checkmeta "https://github.com/siyuan-note/bazaar/blob/main/actions/check/meta.go"
click node_labels "https://github.com/siyuan-note/bazaar/blob/main/actions/check/label.go"
click node_release "https://github.com/siyuan-note/bazaar/blob/main/actions/util/release.go"
click node_rules "https://github.com/siyuan-note/bazaar/blob/main/rules/manifest.go"
click node_filechecks "https://github.com/siyuan-note/bazaar/blob/main/rules/files.go"
click node_deprecation "https://github.com/siyuan-note/bazaar/blob/main/actions/util/deprecated.go"
click node_stage "https://github.com/siyuan-note/bazaar/blob/main/actions/stage/main.go"
click node_incremental "https://github.com/siyuan-note/bazaar/blob/main/actions/stage/incremental.go"
click node_packageindex "https://github.com/siyuan-note/bazaar/blob/main/actions/stage/index.go"
click node_stagereport "https://github.com/siyuan-note/bazaar/blob/main/actions/stage/report.go"
click node_indexpublish "https://github.com/siyuan-note/bazaar/blob/main/actions/index/main.go"
click node_archiveaudit "https://github.com/siyuan-note/bazaar/blob/main/actions/audit-archived/main.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prcheck,node_prselect,node_checkmeta,node_labels toneBlue
class node_release,node_rules,node_filechecks,node_deprecation,node_bazaarstorage toneAmber
class node_stage,node_incremental,node_packageindex,node_stagereport,node_indexpublish toneMint
class node_archiveaudit toneRose
class node_contributor,node_github,node_rhythm toneIndigo
```

## Components

### PR review

- [PR check](https://github.com/siyuan-note/bazaar/blob/main/actions/check/main.go): `actions/check/main.go`
- [PR scheduling](https://github.com/siyuan-note/bazaar/blob/main/actions/check/select.go): `actions/check/select.go`
- [Check metadata](https://github.com/siyuan-note/bazaar/blob/main/actions/check/meta.go): `actions/check/meta.go`
- [PR labels](https://github.com/siyuan-note/bazaar/blob/main/actions/check/label.go): `actions/check/label.go`

### Package validation

- [Release lookup](https://github.com/siyuan-note/bazaar/blob/main/actions/util/release.go): `actions/util/release.go`
- [Package rules](https://github.com/siyuan-note/bazaar/blob/main/rules/manifest.go): `rules/manifest.go`
- [Package file checks](https://github.com/siyuan-note/bazaar/blob/main/rules/files.go): `rules/files.go`
- [Deprecation registry](https://github.com/siyuan-note/bazaar/blob/main/actions/util/deprecated.go): `actions/util/deprecated.go`

### Index staging

- [Stage runner](https://github.com/siyuan-note/bazaar/blob/main/actions/stage/main.go): `actions/stage/main.go`
- [Incremental planning](https://github.com/siyuan-note/bazaar/blob/main/actions/stage/incremental.go): `actions/stage/incremental.go`
- [Package indexing](https://github.com/siyuan-note/bazaar/blob/main/actions/stage/index.go): `actions/stage/index.go`
- [Stage reporting](https://github.com/siyuan-note/bazaar/blob/main/actions/stage/report.go): `actions/stage/report.go`
- [Index publisher](https://github.com/siyuan-note/bazaar/blob/main/actions/index/main.go): `actions/index/main.go`

### Bazaar operations

- [Archived repo audit](https://github.com/siyuan-note/bazaar/blob/main/actions/audit-archived/main.go): `actions/audit-archived/main.go`

### Other components

- **Package contributor**
- **GitHub**
- **Object storage**
- **Rhy service**

## Connections

- Package contributor → PR check: opens PR (evidence: `README.md`)
- PR scheduling → PR check: schedules checks (evidence: `README.md`)
- PR check → GitHub: checks PR (evidence: `actions/check/main.go`)
- PR check → Release lookup: fetches release (evidence: `actions/check/main.go`)
- PR check → Package rules: validates package (evidence: `actions/check/main.go`)
- Package rules → Package file checks: checks files
- PR check → PR labels: syncs labels (evidence: `actions/check/main.go`)
- PR check → Check metadata: records check state
- Stage runner → Incremental planning: plans updates
- Stage runner → Package indexing: stages packages (evidence: `README.md`)
- Package indexing → Package rules: validates package (evidence: `actions/stage/index.go`)
- Stage runner → Release lookup: fetches releases (evidence: `actions/stage/main.go`)
- Stage runner → Deprecation registry: applies deprecations (evidence: `README.md`)
- Stage runner → Stage reporting: reports failures
- Stage runner → Object storage: writes staged data
- Index publisher → Object storage: uploads indexes (evidence: `actions/index/main.go`)
- Index publisher → Rhy service: reports index hash (evidence: `actions/index/main.go`)
- Archived repo audit → GitHub: queries repository state (evidence: `actions/audit-archived/main.go`)
- Archived repo audit → Deprecation registry: reads registry (evidence: `actions/audit-archived/main.go`)
