# Publishing to the Hub — OFS

> Publish your OFS function to the Aerostack Community Hub. Make it discoverable and installable by any Aerostack project with one CLI command.

Once your OFS function works locally, publish it to the Community Hub so other Aerostack projects can discover and use it.

## Prerequisites

- `aerostack.json` manifest present
- Function passes local tests (`aerostack test`)
- Logged in: `aerostack login`

## Publish

```bash
# Publish the current directory
aerostack publish

# Or specify a path
aerostack publish ./my-function
```

Your function is available immediately at:
```
https://aerostack.dev/functions/your-username/function-name
```

## What gets published

- `aerostack.json` manifest (public)
- Compiled function bundle (runs on Cloudflare Workers)
- README.md (if present — shown on the Hub listing)
- Input/output schema (auto-generated from manifest)

Never include secrets, API keys, or credentials in your function bundle. Use `sdk.secrets.get()` at runtime instead.

## Versioning

OFS uses semantic versioning. Publish a new version:

```bash
# Bump version in aerostack.json then:
aerostack publish --version 1.1.0

# Or use the bump shorthand:
aerostack publish --bump patch   # 1.0.0 → 1.0.1
aerostack publish --bump minor   # 1.0.0 → 1.1.0
aerostack publish --bump major   # 1.0.0 → 2.0.0
```

Users who have installed your function can update:
```bash
aerostack functions update function-name
```

## Consuming published functions

To use a function from the Hub in your project:

```bash
aerostack functions add username/function-name
```

Call it from your Worker:

```ts

const result = await sdk.functions.call('username/function-name', {
  userId: 'abc123'
})
```

## Hub listing

Your function's Hub page shows:
- Description from `aerostack.json`
- Input/output schema
- Install command
- README content
- Version history
- Usage statistics (invocation count)

To update your listing, re-publish with a new version.
