# Run a charts repository

> Host a list of charts for your team or your community: the folders of a charts repository, the review statuses, and alta repo index, which builds the index and the archives machines download.

A charts repository is a git repository with a known layout. From it, `alta repo index` builds `index.json` and the archive of every chart; you serve both over https, and anyone can add your repository with `alta repo add`. Here you build the index of the example repository that ships with Alta OS.

**Before you begin (10 minutes)**

- The `alta` command: [install the CLI](https://docs.os.altasystem.ai/start/install).
- A copy of [`examples/charts-repo`](https://github.com/alta-system-os/alta-os/tree/main/examples/charts-repo), or your own repository with the same folders.
- Somewhere to serve static files over https.

### Know the layout

| Path | Holds |
|---|---|
| `repo.json` | the repository: its id, its title, the address of its `index.json`, its tier, where to report a chart |
| `charts/<id>/` | a chart kept in the repository itself |
| `sources/<id>.json` | a pointer to a chart kept in its author's repository: address, full commit, digest |
| `publishers/<id>.json` | who publishes: name, address, tier, handle on the host |
| `moderation.json` | the review status of each version, and withdrawals |
| `index.json`, `index.json.sig` | built from the above by your repository's own job, never edited by hand |

```json [repo.json]
{
  "id": "example",
  "title": { "en": "Example charts", "fr": "Charts d'exemple" },
  "url": "https://charts.example.org/index.json",
  "tier": "community",
  "report": "https://charts.example.org/report",
  "git": "https://git.example.org/alta/charts"
}
```

### Set the review statuses

Every version is `pending` until `moderation.json` gives it a status: nothing is installable before a review. Here two charts passed and `tea-timer` is still pending.

```json [moderation.json]
{
  "night-reading@1.0.0": {
    "audit": {
      "status": "pass",
      "at": "2026-12-05T00:00:00Z",
      "by": "example review"
    }
  },
  "sky-notes@0.1.0": {
    "audit": {
      "status": "pass",
      "at": "2026-12-05T00:00:00Z",
      "by": "example review"
    }
  }
}
```

The statuses and what they allow: [How charts are reviewed](https://docs.os.altasystem.ai/marketplace/review#the-statuses).

### Build the index

A pointer's chart is read from `--checkouts <folder>/<id>/`: its content at the pointed commit, which your job clones first (the example keeps them in `checkouts/` so it builds offline). Its digest must equal the pointer's. `--commit` is the commit of your repository, for the charts kept in it. `--archives` writes each chart's archive next to the index, with the address machines will download it from.

```sh [Terminal]
alta repo index . --checkouts checkouts --commit 3333333333333333333333333333333333333333 --archives https://charts.example.org/archives --out public/index.json
```

```text [Output]
wrote ./public/index.json: 3 charts, 3 archives
  nothing is installable until a review sets its audit (moderation.json); sign index.json before serving it
```

One chart of the index, as machines read it: every version with its digest, its archive, its source, what it needs online and its review status.

```json [public/index.json: charts.sky-notes]
{
  "publisher": "quiet-lab",
  "kind": "agent",
  "title": {
    "en": "Sky notes",
    "fr": "Notes du ciel"
  },
  "summary": {
    "en": "An agent that keeps short notes of what you ask it to remember.",
    "fr": "Un agent qui garde de courtes notes de ce que tu lui demandes de retenir."
  },
  "versions": [
    {
      "version": "0.1.0",
      "created": "2026-12-05T00:00:00Z",
      "digest": "f74392a9d849e5f89ed992850d4bca37b112fb23105050e01263d0b4350fca0c",
      "archive": {
        "url": "https://charts.example.org/archives/sky-notes-0.1.0.alta.tar",
        "sha256": "a63c952c063e9bd69a8f9fd7b4f6ba5ae10d7cec5640c877a295637dd76c71c3",
        "size": 7168
      },
      "source": {
        "git": "https://git.example.org/quiet-lab/sky-notes",
        "commit": "1111111111111111111111111111111111111111",
        "ref": "v0.1.0"
      },
      "license": "MIT",
      "price": "free",
      "locality": "cloud",
      "localityCheck": "linted",
      "services": [],
      "needs": [
        {
          "id": "mind",
          "kind": "mind",
          "providers": [
            "claude",
            "codex",
            "local"
          ],
          "local": true
        }
      ],
      "capabilities": [
        "install"
      ],
      "support": {
        "platforms": [
          {
            "os": "macos"
          },
          {
            "os": "linux"
          }
        ],
        "hosted": "ok"
      },
      "requires": {
        "charts": [
          {
            "id": "alta-os",
            "version": ">=0.1.0 <1.0.0"
          }
        ]
      },
      "audit": {
        "status": "pass",
        "at": "2026-12-05T00:00:00Z",
        "by": "example review"
      },
      "localityRange": {
        "best": "local-first",
        "worst": "cloud"
      },
      "risk": "medium"
    }
  ]
}
```

`locality` and the services are copied from each chart, and `localityCheck: "declared"` says so. Keep older versions with `--previous <old index.json>`.

### Sign and serve

Sign the index with the repository's Ed25519 private key. The key stays in a file only you can read (`chmod 600`), outside the repository; `alta` reads it from that file and never prints it. Make one once with OpenSSL 3 or later (the LibreSSL that comes with macOS has no Ed25519: use Homebrew's `openssl`): `mkdir -p -m 700 ~/keys`, then `openssl genpkey -algorithm ed25519 -out ~/keys/charts.key`, and its public half with `openssl pkey -in ~/keys/charts.key -pubout -out repo-key.pub`.

```sh [Terminal]
alta repo sign public/index.json --key ~/keys/charts.key
```

```text [Output]
signed public/index.json (sha256 ffff72d56b518036d6e594329773cfaab5e27aa1de9a1ea5e6b486ef33ba8fc2) into ./public/index.json.sig
  key: ed25519:9de0f295e97450ce; machines check it with the public key given to alta repo add --key
```

Serve `public/` over https: `index.json`, `index.json.sig` next to it, and `archives/`. Publish `repo-key.pub` next to the index and on your repository's page: people give it to `alta repo add --key`, and their machines refuse any index it did not sign. Build and sign only from your default branch, in a job no pull request can trigger, so a pull request can never change what machines download. The format: [the index specification](https://docs.os.altasystem.ai/reference/advanced/specs/alta-index-0.1#_6-signature).

## Rules your index must follow

- Every address is `https://`, with no user name or password; `repo.report` too.
- A version after the first of a chart says what changed (`changes`).
- A community repository lists free charts only.
- A publisher's tier is `official` only in an official repository.

The whole format: [the index specification](https://docs.os.altasystem.ai/reference/advanced/specs/alta-index-0.1).

**Next:**

- [How charts are reviewed](https://docs.os.altasystem.ai/marketplace/review)
- [Add a repository](https://docs.os.altasystem.ai/marketplace/add-a-repository)
- [alta repo](https://docs.os.altasystem.ai/reference/cli/repo)
