---
name: hart
description: Publish a self-contained HTML or JSX deliverable to a live, shareable, sandboxed URL — and expose it as a discoverable skill with title, description, and keywords. Use whenever you generate an HTML report, dashboard, mockup, one-pager, data explorer, or reusable agent skill and the human needs a link (not a local file), or to list/find/update prior artifacts/skills.
---

# hart — publish your HTML deliverables and skills to a live URL

You (an agent) generate rich HTML but have nowhere to put it: `open` dies at share-time, a gist mangles it. **hart** turns a self-contained file into a live, versioned, sandboxed URL in one call. Add `<meta name="title|description|keywords">` and it also becomes a discoverable skill in the catalog. This instance: `https://private-hart.spikes.intrane.fr` — publishing requires a token (operator-configured `HART_TOKEN`)

## When to use

- You produced an HTML/JSX deliverable and the human needs a **shareable link**.
- The data behind a page you published **changed** — refresh it in place (same URL).
- You want to publish a **reusable skill/runbook** that other agents can discover via `hart list --owner <you> --format skills`.
- You need to **find or list** artifacts or skills you (or your fleet) published before.

## Setup (once)

```sh
export HART_URL=https://private-hart.spikes.intrane.fr
# or put this in a project .hart.env (or ~/.hart/config):
#   HART_URL=https://private-hart.spikes.intrane.fr
#   HART_OWNER_KEY=<your-owner-key>
#   HART_OWNER_KEY_<owner>=<key>    # per-namespace keys in the same flat file
#   HART_READ_KEY_<owner>_<artifact>=<key>
# if this instance requires a publish token: `hart login <token>` (or set HART_TOKEN)
```
No `hart` binary on PATH? Every write is a plain HTTP POST — curl works (see the manual).

## Publish — the core loop

```sh
hart publish deliverable.html --owner <you> --artifact <name>
# -> {"ok":true,"url":"https://private-hart.spikes.intrane.fr/a/<you>/<name>","version":1, ...}
```
Parse `.url` from the JSON and hand it to the human. Re-publish the same `--owner/--artifact` to append a version (`latest` moves; old versions stay pinned; `hart rollback <id> <v>` reverts).

## The contract (do this or publish is rejected)

Pages must be **self-contained**: inline ALL CSS/JS, embed images/fonts as `data:` URIs. Served under a strict CSP — **no external scripts/styles/fonts, no network** (`fetch`/XHR/WebSocket blocked). A linter rejects external refs (HTTP 422); `--dry-run` lints without storing, `--force` overrides. JSX: add `--format jsx` (in-browser React+Babel, no build step; render into `#root`).

**Sales funnels / landing pages** that need Stripe, analytics, web fonts, or embeds: publish with `--csp-mode landing` (relaxes the CSP + skips the linter for that artifact) or `--csp-mode custom --csp-policy '<CSP>'`. Default `strict` keeps the lockdown.

## Living deliverables — update data without re-uploading

Publish a template once, then push just the data; the same URL re-renders. The page reads `{{key}}` placeholders and/or the `window.HART_DATA` global.

```sh
hart publish chart.html --owner <you> --artifact sales
hart data <you>/sales '{"points":[3,1,4,1,5]}'   # same URL, fresh render
```
Great for status boards / dashboards an agent keeps current on a cron. Check how a page is doing with `hart stats <you>/sales` — views, last view, freshness, top referrers (server-side, privacy-respecting). Give a monitored dashboard a freshness SLA (`hart fresh <you>/sales 15m`) and `hart stale` flags it if the updates ever stop — hart emits the signal, your cron alerts.

## Discover what you published

```sh
hart list --owner <you>          # your artifacts (JSON: id, title, latest, updated)
hart list --owner <you> --format skills  # compact skill catalog: title, description, keywords, url
hart get <owner>/<artifact>      # one artifact's metadata + versions (includes description/keywords if present)
hart search [query] --owner <you> --tag <t> --agent <name> --run <id>  # memory-layer search (indexes description/keywords)
hart lineage <owner>/<artifact>  # walk the parent chain (provenance)
hart related <owner>/<artifact>  # artifacts linked to/from this one
hart explore [query]             # public discovery feed across the instance
```
Operators of an instance they host can set `HART_ADMIN_TOKEN` and use `hart admin owners` / `hart admin list` to discover **every** owner's artifacts (cross-owner) — the fleet-wide view.

## Skill authoring

To expose an artifact as a skill, add these `<meta>` tags in the `<head>`:

```html
<meta name="title" content="Skill title">
<meta name="description" content="One-line description">
<meta name="keywords" content="ops, runbook, agent-skill">
```

- `--title` wins over `<meta name="title">`.
- `--meta '{"description":"..."}'` wins over `<meta name="description">`; without `--meta`, HTML-derived values update on re-publish.
- `<meta name="keywords">` becomes a JSON array and is searchable with `hart search --tag`.

Then `hart list --owner <you> --format skills` returns a compact catalog with `title`, `description`, `keywords`, `visibility`, and `url`. Private skills are only described for callers with the read/owner/admin key.

## Memory layer

Attach provenance at publish: `--agent <name> --run <id> --parent <id> --tags a,b --meta '{...}'`. Use `hart meta <id> [json]` to annotate, `hart search` to find, `hart diff` to compare versions, `hart checkpoint` to label versions, and `hart link` / `hart related` to relate artifacts.

## Visibility

`--visibility unlisted` (default: public-read, unlisted) · `public` (listed at `/explore`) · `private` (password-gated; agents send `X-Hart-Read-Key` / `HART_READ_KEY`) · `team` (**hart Pro** — read-gated by team membership: any member of the owner reads it via `X-Hart-Member-Key` / after `hart join <owner>`, no shared password; a `reader`-role member reads but can't write). Set at publish (`--visibility --read-key`) or later via `hart visibility <id> <mode>`.

## Custom domains & platform delivery

Serve a public artifact on a creator's own domain: `hart domain <you>/<name> shop.example.com` maps `Host -> artifact` and hart serves it chromeless at `/` (add `--emit-traefik` to print a ready Traefik router block; `hart domains` lists, `hart domain-rm <domain>` unmaps, `hart domains --prune` removes orphan/stale mappings). Provisioning stays in your reverse proxy — hart only records + serves the mapping. For self-service `*.hart.intrane.fr` subdomains the daemon enforces `HART_DOMAIN_ALLOW/DENY/PRIVATE_PATTERNS/SUBDOMAIN_OWNER_MATCH/MAX_PER_OWNER/GC_INTERVAL`. Check availability with `POST https://private-hart.spikes.intrane.fr/v1/domain/check?domain=foo.example.com`. A platform backend can also fetch a raw stored body server-side with `hart get <id> --html [--read-key <pw>]` (private needs the read key, no owner/admin token) to re-serve or deliver it as a gated download.

## Teams, SSO & Pro

Some features need a **hart Pro** license — run `hart upgrade` for a checkout link (hand the URL to the human; they're emailed a key; then `hart license <key>`, or set `HART_LICENSE_KEY` on the daemon; `hart license status` shows your tier). Pro unlocks higher storage limits, `hart audit` (who changed what), and **teams**.

**Teams** — share an `--owner` namespace with per-member keys: an admin runs `hart team invite <owner> <email>`; each member holds their own key (send it as `HART_MEMBER_KEY` or `--member-key`), and the audit log records who did what. Revoke with `hart team rm`.

**SSO self-onboarding** — a member runs `hart join <owner>`, opens the returned link to sign in, and their agent receives the member key (no key hand-off). hart is a **generic OpenID Connect client**: to enable it, the operator sets on the daemon `HART_OIDC_ISSUER` (your IdP — Auth0/Okta/Keycloak/Google/machin-idp/…), `HART_OIDC_CLIENT_ID`, `HART_OIDC_CLIENT_SECRET` (optional `HART_OIDC_SCOPES`, default `openid email`), and registers `https://private-hart.spikes.intrane.fr/team/callback` as the redirect URI at that IdP. Unset = SSO off (teams still work via member keys).

## Workflow caveats from usage

- No `hart` binary? Publish with curl: `curl -s -X POST 'https://private-hart.spikes.intrane.fr/v1/publish?owner=<owner>&artifact=<slug>&visibility=unlisted' -H 'content-type: text/html' --data-binary @file.html`
- Convert Markdown to self-contained HTML with pandoc: `pandoc --embed-resources --standalone --css style.css -f markdown-yaml_metadata_block --metadata title='...' -o out.html in.md`. Use `-f markdown-yaml_metadata_block` when the Markdown frontmatter contains unquoted colons (e.g. `Asunto: foo: bar`).
- Re-publishing the same `owner/artifact` updates `latest`; old versions stay at `/v<n>`.
- Move/delete an artifact: `curl -s -X DELETE 'https://private-hart.spikes.intrane.fr/v1/artifacts/<owner>/<artifact>'`.

> **Agent self-improvement note:** After each hart session, if you discover a new caveat, faster command, or API detail, append a concise bullet to this 'Workflow caveats from usage' section and to any in-repo `.devin/skills/hart/SKILL.md` if it exists. Keep it factual and non-duplicative.

## Full manual

Run `hart guide` or GET `https://private-hart.spikes.intrane.fr/guide.md` — every command, flag, and the admin API, version-exact. AI-first sitemap: `https://private-hart.spikes.intrane.fr/llms.txt`.
