# Publish your package
Haps publishes software under your Nostr public key. There is no registry account,
submission queue, or globally reserved package name. This guide uses an
already-built program called `my-app` and Haps 0.1.11 or later.
## 1. Stage the files
Build your program using its normal build tools. Copy only the executable and
runtime files into a separate directory:
```sh
mkdir -p stage/bin
cp path/to/my-app stage/bin/my-app
```
On Windows, use `New-Item -ItemType Directory -Force stage/bin` and
`Copy-Item path/to/my-app.exe stage/bin/my-app.exe`, and set the command path in the manifest to
`bin/my-app.exe`. Include required DLLs and resources in the
locations your app expects. Haps does not resolve system dependencies yet.
For a macOS app, stage the whole bundle as `stage/MyApp.app` and use
`app = "MyApp.app"` in the manifest instead of `[commands]`. The current package format supports
regular files and directories; bundles requiring symlinks are not supported.
Preserve the app's platform signing when preparing it.
## 2. Create and check the manifest
Generate `haps.toml` outside the payload, then review its metadata:
```sh
haps init --name my-app --command bin/my-app --payload stage
```
You can also write the manifest by hand:
```toml
name = "my-app"
version = "0.1.0"
target = "aarch64-apple-darwin"
description = "What your app does"
[commands]
my-app = "bin/my-app"
```
Use the target printed by `haps target`, or the platform you built for when
cross-compiling. Package names use lowercase letters, numbers, hyphens, or
underscores. Versions use SemVer. Unknown manifest fields are rejected.
`init` never overwrites an existing manifest, creates a signing identity, uploads
files, or prompts for input. It checks that the executable (or bundle metadata)
exists. The target defaults to this machine; override it with `--target`.
Use `--version`, `--description`, and `--out` to set metadata and the output path,
and add `--json` for machine-readable output. Review the description before packing.
Linux GUI packages can also add launcher metadata:
```toml
[desktop]
name = "My App"
command = "my-app"
icon = "share/icons/my-app.png"
```
The command names a key in `[commands]`; the icon is a packaged PNG or SVG.
Windows GUI packages use the same `[desktop]` fields with a packaged `.ico`
icon and a declared `.exe` command. They get a per-user Start menu shortcut.
Optionally add `uri_schemes = ["my-app"]` to handle `my-app://` links; Haps passes
one URI argument directly to the executable. Schemes must be lowercase ASCII
letters, digits or hyphens, beginning with a letter; common system schemes are
reserved. URI registration currently supports Windows only.
Haps updates and removes only its own shortcuts and handlers, scoped to the
publisher and Haps home. Existing handlers (including a previous installer’s)
are preserved and block registration; remove or migrate those explicitly first.
Windows desktop declarations are carried in a signed `haps/windows-desktop-v1`
event tag, so older Haps versions can still read a mixed-platform catalog. New
clients validate the declaration before using it; older clients install commands
without registering Windows desktop integration.
A failed install restores the previous integration. No administrator privileges
or package-provided installation scripts are used.
Declared commands run directly, with no shell or install hooks.
## 3. Sign and test locally
Create a signing identity once, then keep using it for future versions:
```sh
haps identity init
haps identity show
haps pack haps.toml --payload stage --out catalog
```
`identity show` prints your **package publisher public key**. Substitute it for
`PACKAGE_KEY` below. If you already have a Haps identity, skip `identity init`.
Keep its secret key backed up and outside the catalog and payload. You can also
give `pack` an external key with `--key-file`.
`pack` creates or extends a local catalog with signed releases, a search index,
and content-addressed files. It checks the complete payload, including ignore
rules and whether declared commands are included. It does not upload anything.
Haps 0.1.24 reads both legacy Hashtree keys and the versioned keys used by
Hashtree 0.3. New packages and catalogs use versioned CHK references. Readers
through Haps 0.1.23 need a legacy catalog to install their upgrade. Publish
that transition package with the previous verified Haps publisher, or upgrade
the CLI using its prebuilt installer or Cargo. When checking a previously
signed Haps payload, 0.1.24 reproduces the original CHK encoding so an
unchanged legacy release keeps its exact manifest ID.
Try the staged app's basic functionality inside a VM or container before sharing.
After publishing, test discovery and installation from a separate Haps profile as
shown below. A successful install alone does not prove the app works.
From 0.1.13, installation also requires an explicit
audit of the exact release by default (`--allow-unaudited` bypasses it for one operation). Another reader needs an audit from their social graph;
your publisher self-audit only counts for your own installation. Provide pinned
source and a matching `[build]` section in the same `haps.toml` to support automatic binary reproduction (legacy `haps-build.toml` is also accepted). Source installation audits and builds the pinned source without requiring a publisher-binary match. See the
[audit workflow](README.md#release-audits) for source review,
rebuild comparison, and approvals with unverified reproducibility stated. Before
sharing, follow [Preparing a package for audit](README.md#preparing-a-package-for-audit)
for dependency locks, verified downloads, prerequisites, and review coverage.
## Managed event catalogs
To publish a fork after a failed audit, use the optional
[repair workflow](README.md#repairing-a-failed-audit): preserve the findings with
`haps audit repair prepare`, commit the fix in your own source repository, then
run `haps audit repair build` for a fresh review and locally signed build.
`haps audit repair publish` shares only that selected repair and its audit.
You can stop at any step if the package is unsuitable for repair.
For routine publishing, Haps can maintain the output directory and selected
Nostr event index itself:
```sh
haps add haps.toml --payload stage
haps catalog show
haps catalog publish
```
The default catalog is `default`; use `--catalog NAME` on `add` for another
collection and `haps catalog publish NAME` to share it. A local publishing
identity is created on the first staged `add` if none is configured. Keep that
identity for subsequent releases. An identity configured with `identity use`
contains only a public key and cannot sign releases.
To publish an already prepared catalog with an external signing key, use
`haps catalog publish NAME --key-file PATH` (or `HAPS_KEY_FILE`). The key must
match the catalog signer. This preserves the prepared releases and does not
create or change the local publishing identity. Keep the same Haps home,
uploader, storage, and file-server configuration to reuse upload checkpoints.
Adding a staged release does not upload or install it. Publishing uploads its
content, signs package heads that reference exact releases and immutable
Hashtree roots, and publishes an ordinary `hashtree-nostr` event index. Its root
uses the existing Hashtree kind-30064 announcement format, so other Nostr index
readers can query it without Haps-specific metadata. `haps install
publisher/package` can then resolve the package directly through Nostr relays or
Hashtree event indexes, without resolving a mutable directory catalog.
To include an existing publisher's package, use `haps add publisher/package`
without `--payload`. Its original signed events are preserved. Repeat the
command to refresh the selected records. `haps catalog remove publisher/package`
removes the selection from the next catalog publication; it does not revoke the
publisher's release or uninstall anything.
Empty collections are not published.
The directory-based workflow below remains supported. `haps publish` also
produces direct package heads using the uploaded directory's immutable hash.
Existing readers can still use its named directory catalog.
## 4. Share your package
The prebuilt Haps bundle includes the [Hashtree CLI](https://git.iris.to/#/npub1xdhnr9mrv47kkrn95k6cwecearydeh8e895990n3acntwvmgk2dsdeeycm/hashtree/rust/crates/hashtree-cli/README.md?g=)
and Git helper. `haps publish` uses a compatible `htree` on PATH or its bundled
copy. If you installed only Haps through Cargo, run `cargo install hashtree-cli --locked`
once if you do not already have it.
Choose a publication name once, then keep it for future updates:
```sh
haps publish catalog --name my-packages
```
The hosting identity can differ from the package publisher. Haps discovers the
location from signed announcements and pins it to the original publisher;
readers find your package automatically. Keep both
signing keys private.
`haps publish` also announces the catalog on your configured Nostr relays using
the Haps publisher's key. It must match the catalog signer; use `--key-file` when
you packed with a separate key. The hosting identity remains independent.
Announcements that do not receive a relay acknowledgement stay queued locally;
retry them with `haps sync`. A publication exits unsuccessfully until its own
required announcements receive positive relay acknowledgements. Older unrelated
outbox entries remain queued and are reported separately. `haps sync` retries
the whole queue and exits unsuccessfully if anything remains unacknowledged.
Package announcements include up to 64 recent release references, preserving the
latest release and latest stable release for each platform. The signed catalog
and event index retain the complete history. Haps 0.1.27 can resolve older
versions outside that announcement window with `--version`; earlier readers can
install them from the immutable catalog URL.
Managed catalogs and `import-release --publish` keep private upload checkpoints
outside the published directory. With a compatible `htree`, later publications
reuse unchanged source-file addresses and upload only changes since the last
successfully uploaded root. An unchanged retry preserves signed release and head
events. Failed uploads never advance that checkpoint. Changing the catalog,
helper path or bytes, storage directory, or file-server configuration starts a
separate scope. Restoring the same helper at the same path preserves the
checkpoint even when its modification time changes. The first publication after
upgrading from metadata-based checkpoints addresses the complete catalog once.
An execute-only helper can publish without checkpoints.
Haps probes optional helper capabilities: directory addressing caches require the
new Unix `htree add --cache` option; retained-root delta upload is available from
`htree` 0.2.152. Older bundled or installed helpers remain supported, with a clear
notice when these speedups are unavailable. The addressing cache trusts stable
Unix file identity/change metadata and immutable local content-addressed storage;
upload checkpoints trust retention on the same previously successful file-server
configuration. These caches do not perform a full payload-integrity or remote
retention audit on every publication.
Readers can find your package by name or publisher:
```sh
haps search my-app
haps info PACKAGE_KEY/my-app
haps install PACKAGE_KEY/my-app
# Optional local shortcut:
haps alias add maker PACKAGE_KEY
```
Readers choose their own trust policy. If they want to follow your publishing
key, they can create a Haps signing identity once and follow it:
```sh
haps identity init # skip if already configured
haps follow PACKAGE_KEY
haps install PACKAGE_KEY/my-app
haps run my-app
```
Alternatively, readers can require release attestations from keys they already
trust. See [release attestations](README.md#social-discovery-and-release-attestations).
Adding a source or alias alone does not authorize installing its packages.
You can also share the immutable Hashtree hash of the uploaded directory catalog:
`haps install nhash1…` (or `htree://nhash1…`). A catalog containing several
packages needs `--select PACKAGE_KEY/my-app`. This pins the catalog contents;
normal signatures, audit requirements, and release warnings still apply. Share
the package directory hash, not the Nostr event-index root or a bare payload hash.
Share `haps install PACKAGE_KEY/my-app`. Discovery uses preset indexes and
signed announcements, with results ranked by the reader's social graph. No
manual catalog setup is required. A relay or index may not have every package;
failed publication acknowledgements can be retried with `haps sync`.
## 5. Publish updates and other platforms
For an update, rebuild, restage, increment `version`, and repeat:
```sh
haps pack haps.toml --payload stage --out catalog
haps publish catalog --name my-packages
```
Keep the same signing key, catalog directory, and Hashtree name. The local catalog
retains previous releases; replacing it with a fresh directory would lose that
history. A publisher/name/version/target coordinate cannot be republished. Use a
new version even for a small binary fix. Readers run `haps update my-app` and can
use `haps rollback my-app` to return to their previous installed version.
Build and test each platform separately. Use a separate manifest with the same
name and version and the correct `target`, then pack it into the same catalog.
Haps selects the reader's platform. Pre-release versions require an explicit
`--version` when installing.
For source-based installation, provide an inspected build recipe and a pinned
Git commit instead. [The source build guide](README.md#build-from-a-git-repository)
covers HTTPS and Hashtree Git URLs.
## Files included in a package
Packing respects `.gitignore` and `.ignore` files inside the payload, including
nested rules and negation. It skips Git metadata, OS junk, root build/dependency
caches, and local `.env` files. Rules outside the payload and global Git ignores
do not affect the package. Runtime dependencies nested inside an app remain
included unless its own ignore rules exclude them. All symlinks and special
files are currently rejected.
Keep the manifest, catalog output, signing keys, and source working tree outside
the staged payload. Source recipes copy only declared build outputs into a fresh
payload before packing.
Installed versions live in Haps's per-user data directory. Haps verifies files
before activation and keeps prior versions for rollback. On Windows it uses the
user's Local AppData directory; on macOS app bundles stay in their versioned slot
and open through Launch Services. Haps does not add commands to PATH or copy apps
into system application directories. Use `haps run`, `haps path`, and `haps list`
to run and inspect installations.
## Existing release flows: build once, publish through Haps
Iris Git and `htree release publish` share the same release directory:
`releases/<repo>/<tag>/release.json`, `notes.md`, and `assets/`. Keep that as a
compatibility inventory for existing release pages and app updaters. Haps' signed
`haps.release.v1` events and `haps.files.v1` manifests are the authoritative
package format for installation. Hashtree stores those objects and the native
Nostr event index; it does not define a second software-package format. `latest` selects the Hashtree release;
Haps package-head events select signed package versions for each platform.
New Haps publishers should use `haps add` / `haps pack` and `haps catalog publish`
with the native package format described above; they do not need the older
release inventory. `import-release` is the compatibility boundary for established
build and distribution flows. It never changes Haps' package schema to match a
Hashtree app updater.
The repository's `haps-release.json` maps those existing assets to package
names, targets, commands and app/desktop metadata. It pins the publishing key,
source repository and catalog name. Each selected `release.json` asset needs
its exact size and SHA-256. Asset paths are relative to that release directory;
`{tag}` in mappings substitutes only the explicitly requested tag.
```sh
# Requires Haps with the import-release subcommand, Python 3.9+, and htree for upload.
# HAPS_KEY_FILE may select an existing secret-key file; otherwise Haps uses
# its existing identity.key. Never generate a new identity during a release.
haps import-release stage --config haps-release.json --tag v1.2.3 --check
# Publish and cold-verify the pinned source before making binary assets public:
haps import-release stage --config haps-release.json --tag v1.2.3 --publish-source
# After the project's existing release gates and canonical publication:
haps import-release stage --config haps-release.json --tag v1.2.3 --publish
```
`--check` validates the signer, stable tag, checksums and payload layout without
signing or uploading; a draft can be checked but cannot be published. Preparation uses tar/zip/Debian payloads without executing
install scripts. Symlinks and special files fail explicitly, matching Haps'
current package format. The adapter retains regular-file bytes and executable
permissions, including signed macOS bundles. Native installers, Android and iOS
remain on their existing distribution channels; map their desktop/CLI archives
only when those can be installed as ordinary files.
From 0.1.22, `--publish-source` pushes the exact owned Hashtree source revision
and checks its complete Git history from an empty cache. It does not publish
binary assets. Normal package publication repeats the source check before
announcing packages. It groups all retained source revisions by exact repository
URL, pushes locally available owned revisions together, and checks every revision
and its history in one fresh clone per URL. Missing, shallow, or corrupt history
blocks publication; earlier verification and publisher caches are not reused.
See [source publication](README.md#package-discovery-and-event-catalogs)
for checkout and identity requirements. CI can independently run
`scripts/verify-public-source.py` with checksum-pinned Git helpers, without a
signing key, before creating a public binary release.
Large repositories can set `--clone-timeout 2700` (seconds; default 300,
maximum 3600). Allow additional time in the CI job for the revision and
complete-history checks, which retain their own command deadlines.
To select established public read servers explicitly:
```sh
python3 scripts/verify-public-source.py --commit FULL_COMMIT --helpers PATH_TO_HELPERS \
--read-server https://cdn.iris.to --read-server https://upload.iris.to \
--clone-timeout 2700
```
Only these two exact HTTPS origins are accepted. With both selected, the pinned
helper tries CDN then upload. Without `--read-server`, helper defaults remain
unchanged. Selection writes a temporary isolated configuration; the local data
cache starts empty and helper pins, hash checks and full-history checks remain
unchanged. Shared public caches may already be warm: this proves availability
through the selected servers, not cold public-cache speed or default-route
performance. A first fetch of large histories can still take many minutes.
Publication keeps original release events on a byte-identical retry, refuses
changed bytes at an existing version, uploads immutable packages and a native
Hashtree Nostr event index, and requires relay acknowledgement. Failed events
remain queued for `haps sync`; a nonzero release result is not a completed
release. Source commits and package publishers stay pinned during updates.
For date tags, `version_scheme: "date-revision"` maps `v2026.10.5.2` to
`2026.10.502`, retaining ordering and compatibility with existing Iris packages.
Other repositories use stable SemVer tags. Haps' own release mirror runs this
adapter on the same five checksum-verified binary bundles, including helpers.