HTML artifact delivery
Delivery policy for any HTML you hand to the user. It composes with whichever
skill authored the page (BMAD, dashboards, reports, docs, build tools). A local
path or file:// link is not a delivery. The delivery is the exact public
entry URL. S3 serves no directory index, so never give a bare prefix.
This is guidance, not enforcement. Nothing blocks a local link, so the job is
yours.
Workflow
- Stage the artifact in its own directory: the entry HTML plus every file it
loads, with relative paths. Never point
--bundle at a repo root. For built
apps (Vite, Next export, etc.), stage the complete build output
(dist/, out/) and use relative asset paths (Vite: base: './').
- Plan (default, offline, writes nothing):
S=~/.agents/skills/html-artifact-delivery/scripts/publish_html_artifact.py
python3 "$S" --bundle ./out/report --entry index.html --artifact sprint-review \
--project-root "$PWD"
Fix every errors entry. Then localize or bundle every external_resources
(CDN scripts, styles, fonts, images) and unresolved entry (bare module
specifiers, templated paths). --publish refuses while either is non-empty
(publishable: false). Plain external hyperlinks (<a href>) are fine.
- Waive inspected JS false positives (only if the plan reports them). JS
module discovery is raw text matching, so import-shaped text in strings,
comments and regex literals is reported too. React's development build, for
example, reports
./MyComponent from a warning string in _vendor/react.js.
First run the plan with no flag. Then a human opens the named file and
inspects every occurrence of the reported specifier. Only when none of
them is a real import, re-plan with the exact pair:python3 "$S" ... --accept-js-candidate _vendor/react.js:./MyComponent
FILE is the bundle-relative POSIX path of the .js/.mjs file, or of
the .html/.htm/.svg file whose inline <script> emitted it. The
value is split at the first colon, so the specifier may contain colons.
SPECIFIER is the exact emitted string. There is no normalization, glob,
prefix or fuzzy matching. Never waive a vendor or React file wholesale.
- One pair waives all JS occurrences of that specifier in that one file,
including a real import that shares the string. That is why every
occurrence must be checked. The same specifier in another file still blocks.
HTML attributes and CSS references are never waived.
- Unused or malformed pairs are refused (
bundle_invalid /
acceptance_invalid, exit 2). Repeat the flag for each pair; identical
duplicates collapse. Security checks (dangerous names, key material,
symlinks, traversal) cannot be waived.
- The receipt lists the waivers in
accepted_js_candidates ([] when none).
- Publish (opt-in): run the same command with
--publish, repeating any
--accept-js-candidate flags unchanged. It uploads with the
existing mc alias delo into the fixed projects bucket, then fetches every
object anonymously from https://s3.delo.sh and checks status, MIME, and the
exact SHA-256 of the bytes served.
- Report
entry_url from the receipt only when ok is true (the receipt
also carries delivered: true only for a verified publish; a plan or any
failure is delivered: false). For dynamic JS, also open the URL in a
browser and confirm it renders without console or network errors before
calling it delivered.
Identity (fails closed when missing or ambiguous)
- Project:
--project SLUG, or .project.json project_slug and then
project_id, read from the main worktree (via Git commondir) and the current
worktree. Branch names, directory basenames, and board identifiers are never used.
Conflicting values fail.
- Session:
--bb-session-id UUID, or --harness NAME --native-session-id ID,
or auto-detected from exactly one of CODEX_THREAD_ID/CODEX_SESSION_ID,
HERMES_SESSION_ID, CLAUDE_SESSION_ID/CLAUDE_CODE_SESSION_ID. Mapping matches
Bloodbank agent-hooks: a UUID passes through, and anything else becomes
uuid5(NAMESPACE_URL, "bloodbank:{harness}:{native}"). The receipt records the
provenance.
- Artifact:
--artifact NAME is required. It keeps two artifacts in one session
from overwriting each other. A new version means a new name, because there is no
replace mode.
What the scan rejects
Symlinks, .git/.env*/credential/key files (including .s3cfg, .pgpass,
credentials*, secrets.*), private-key material (OpenSSL, OpenSSH, PGP
armor), .. escapes, root-relative (/x), file:, localhost/private-network
URLs, insecure http: subresources, <base href>, directory links, missing
local assets, a --bundle path that goes through a symlink, unreadable files,
an unreadable subdirectory (enumeration fails closed: no partial publish), and
names with control characters or trailing newlines. Assets
load from HTML attributes (src, href, srcset, poster, …), inline and
external CSS url()/@import, raw JS import/import(...)/from literal
specifiers (in .js/.mjs files and inline scripts), and standalone
SVG href/xlink:href/<?xml-stylesheet?> references. Non-JavaScript
<script type> blocks (JSON, import maps, templates) are data, not code, and
are not parsed as JS. Dotfiles, .map/.ts/.tsx/.jsx sources publish only
with an explicit warnings entry saying they will be public.
Limits (say these when they apply)
- Discovery is static.
fetch(), computed URLs, and runtime-injected assets are not
seen, so ship the full build output and verify in a browser.
- JS import discovery is raw text matching, not a lexer or parser, and it does
not decide whether a match is code. It reports a string literal after
import, after import ( (including ...import( and whitespace or comment
gaps), and after from (whatever the binding names). Matches inside strings,
comments and regexes are reported on purpose, and a closing quote can be read
as an opener (for example "passed from " + name reports + name +). Each
false positive blocks until it is inspected and waived exactly.
- It does not find computed
import(expr), escaped keywords, or anything that
only a full ECMAScript parser could find. It does not cover arbitrary
ECMAScript. Specifier escapes stay raw. A template specifier keeps its
${...} and stays unresolved. A literal cut off by a line break or the end of
the file is skipped. A literal longer than 4096 characters is reported
truncated. If the bounded work budget runs out, the bundle is rejected
instead of returning a partial scan. Browser verification remains necessary.
- Every required resource has to be a local file. External resources, bare module
specifiers, and templated paths are listed in the dry run and block
--publish.
- There is no atomic collision guard. Preflight
mc ls refuses a non-empty prefix
(and fails if the listing can't be parsed), but two concurrent publishes to the
same prefix can still race. Use distinct --artifact names.
- A partial failure leaves the objects that were already uploaded (nothing is
deleted). Every failure path — including a timeout,
mc disappearing, or any
other OS error mid-upload — reports uploaded, failed (or the failing
command) and not_attempted. Retry with a new --artifact.
- Uploads read a private snapshot of the validated bytes, not the live source
paths: a file swapped or rewritten between the plan and the upload fails the
publish (
bundle_changed) instead of publishing unvalidated bytes. Scan and
snapshot both open sources through O_NOFOLLOW directory-descriptor chains
and read from the validated handles, so a name swapped to a symlink between
enumeration and the byte read cannot publish outside bytes. A failed
snapshot attempt removes its partial copy.
- Objects are public and use
Cache-Control: no-cache, no-transform. The
no-transform stops the Cloudflare proxy from injecting its analytics beacon
into HTML, which would break the byte-exact SHA check. Verification is never
relaxed or normalized to accept a rewritten body. Never publish anything private.
Exit codes
0 ok · 2 invalid input/bundle/identity/remote, or unresolved dependencies on publish · 3 collision · 4 mc/preflight/timeout before any upload ·
5 upload failed (partial, including a timeout or missing mc mid-upload) · 6 public verification failed. The JSON goes to stdout.
mc stderr is never echoed, and mc messages are redacted.
Do not
Create buckets, change bucket policy, run mc alias list, read mc config or
credential files, use mc mirror --remove, or delete objects.
Sample bundle for a live check: assets/sample-bundle/. Its page shows
CSS/Image/JavaScript status lines, and all three should turn green. It declares a
relative favicon so the browser doesn't request the bucket-root /favicon.ico
(403).
Tests: python3 -m unittest discover -s tests -v (from this directory).
1---2name: html-artifact-delivery3description: Deliver every HTML artifact (reports, dashboards, docs, BMAD/worktree/hidden outputs, self-contained or built sites) as a public URL at https://s3.delo.sh/projects/{project-slug}/{bb-session-id}/{artifact}/ with all CSS, JS and images. Use whenever you hand an HTML file to the user, whichever skill authored it.4metadata:5 source: https://skillmd.com/skills/delorenj/html-artifact-delivery6---78# HTML artifact delivery910Delivery policy for **any** HTML you hand to the user. It composes with whichever11skill authored the page (BMAD, dashboards, reports, docs, build tools). A local12path or `file://` link is not a delivery. The delivery is the exact public13**entry URL**. S3 serves no directory index, so never give a bare prefix.1415This is guidance, not enforcement. Nothing blocks a local link, so the job is16yours.1718## Workflow19201. **Stage** the artifact in its own directory: the entry HTML plus every file it21 loads, with relative paths. Never point `--bundle` at a repo root. For built22 apps (Vite, Next export, etc.), stage the **complete build output**23 (`dist/`, `out/`) and use relative asset paths (Vite: `base: './'`).242. **Plan** (default, offline, writes nothing):25 ```bash26 S=~/.agents/skills/html-artifact-delivery/scripts/publish_html_artifact.py27 python3 "$S" --bundle ./out/report --entry index.html --artifact sprint-review \28 --project-root "$PWD"29 ```30 Fix every `errors` entry. Then localize or bundle every `external_resources`31 (CDN scripts, styles, fonts, images) and `unresolved` entry (bare module32 specifiers, templated paths). `--publish` refuses while either is non-empty33 (`publishable: false`). Plain external hyperlinks (`<a href>`) are fine.343. **Waive inspected JS false positives** (only if the plan reports them). JS35 module discovery is raw text matching, so import-shaped text in strings,36 comments and regex literals is reported too. React's development build, for37 example, reports `./MyComponent` from a warning string in `_vendor/react.js`.38 First run the plan with **no** flag. Then a human opens the named file and39 inspects **every** occurrence of the reported specifier. Only when none of40 them is a real import, re-plan with the exact pair:41 ```bash42 python3 "$S" ... --accept-js-candidate _vendor/react.js:./MyComponent43 ```44 - `FILE` is the bundle-relative POSIX path of the `.js`/`.mjs` file, or of45 the `.html`/`.htm`/`.svg` file whose inline `<script>` emitted it. The46 value is split at the **first** colon, so the specifier may contain colons.47 - `SPECIFIER` is the exact emitted string. There is no normalization, glob,48 prefix or fuzzy matching. Never waive a vendor or React file wholesale.49 - One pair waives **all** JS occurrences of that specifier in that one file,50 **including a real import that shares the string**. That is why every51 occurrence must be checked. The same specifier in another file still blocks.52 HTML attributes and CSS references are never waived.53 - Unused or malformed pairs are refused (`bundle_invalid` /54 `acceptance_invalid`, exit 2). Repeat the flag for each pair; identical55 duplicates collapse. Security checks (dangerous names, key material,56 symlinks, traversal) cannot be waived.57 - The receipt lists the waivers in `accepted_js_candidates` (`[]` when none).584. **Publish** (opt-in): run the same command with `--publish`, repeating any59 `--accept-js-candidate` flags unchanged. It uploads with the60 existing `mc` alias `delo` into the fixed `projects` bucket, then fetches every61 object anonymously from `https://s3.delo.sh` and checks status, MIME, and the62 exact SHA-256 of the bytes served.635. **Report** `entry_url` from the receipt only when `ok` is `true` (the receipt64 also carries `delivered: true` only for a verified publish; a plan or any65 failure is `delivered: false`). For dynamic JS, also open the URL in a66 browser and confirm it renders without console or network errors before67 calling it delivered.6869## Identity (fails closed when missing or ambiguous)7071- **Project**: `--project SLUG`, or `.project.json` `project_slug` and then72 `project_id`, read from the main worktree (via Git `commondir`) and the current73 worktree. Branch names, directory basenames, and board identifiers are never used.74 Conflicting values fail.75- **Session**: `--bb-session-id UUID`, or `--harness NAME --native-session-id ID`,76 or auto-detected from exactly one of `CODEX_THREAD_ID`/`CODEX_SESSION_ID`,77 `HERMES_SESSION_ID`, `CLAUDE_SESSION_ID`/`CLAUDE_CODE_SESSION_ID`. Mapping matches78 Bloodbank agent-hooks: a UUID passes through, and anything else becomes79 `uuid5(NAMESPACE_URL, "bloodbank:{harness}:{native}")`. The receipt records the80 provenance.81- **Artifact**: `--artifact NAME` is required. It keeps two artifacts in one session82 from overwriting each other. A new version means a new name, because there is no83 replace mode.8485## What the scan rejects8687Symlinks, `.git`/`.env*`/credential/key files (including `.s3cfg`, `.pgpass`,88`credentials*`, `secrets.*`), private-key material (OpenSSL, OpenSSH, PGP89armor), `..` escapes, root-relative (`/x`), `file:`, localhost/private-network90URLs, insecure `http:` subresources, `<base href>`, directory links, missing91local assets, a `--bundle` path that goes through a symlink, unreadable files,92an unreadable subdirectory (enumeration fails closed: no partial publish), and93names with control characters or trailing newlines. Assets94load from HTML attributes (`src`, `href`, `srcset`, `poster`, …), inline and95external CSS `url()`/`@import`, raw JS `import`/`import(...)`/`from` literal96specifiers (in `.js`/`.mjs` files and inline scripts), and standalone97SVG `href`/`xlink:href`/`<?xml-stylesheet?>` references. Non-JavaScript98`<script type>` blocks (JSON, import maps, templates) are data, not code, and99are not parsed as JS. Dotfiles, `.map`/`.ts`/`.tsx`/`.jsx` sources publish only100with an explicit `warnings` entry saying they will be public.101102## Limits (say these when they apply)103104- Discovery is static. `fetch()`, computed URLs, and runtime-injected assets are not105 seen, so ship the full build output and verify in a browser.106- JS import discovery is raw text matching, not a lexer or parser, and it does107 not decide whether a match is code. It reports a string literal after108 `import`, after `import (` (including `...import(` and whitespace or comment109 gaps), and after `from` (whatever the binding names). Matches inside strings,110 comments and regexes are reported on purpose, and a closing quote can be read111 as an opener (for example `"passed from " + name` reports `+ name +`). Each112 false positive blocks until it is inspected and waived exactly.113- It does not find computed `import(expr)`, escaped keywords, or anything that114 only a full ECMAScript parser could find. It does not cover arbitrary115 ECMAScript. Specifier escapes stay raw. A template specifier keeps its116 `${...}` and stays unresolved. A literal cut off by a line break or the end of117 the file is skipped. A literal longer than 4096 characters is reported118 truncated. If the bounded work budget runs out, the bundle is rejected119 instead of returning a partial scan. Browser verification remains necessary.120- Every required resource has to be a local file. External resources, bare module121 specifiers, and templated paths are listed in the dry run and block `--publish`.122- There is no atomic collision guard. Preflight `mc ls` refuses a non-empty prefix123 (and fails if the listing can't be parsed), but two concurrent publishes to the124 same prefix can still race. Use distinct `--artifact` names.125- A partial failure leaves the objects that were already uploaded (nothing is126 deleted). Every failure path — including a timeout, `mc` disappearing, or any127 other OS error mid-upload — reports `uploaded`, `failed` (or the failing128 command) and `not_attempted`. Retry with a new `--artifact`.129- Uploads read a private snapshot of the validated bytes, not the live source130 paths: a file swapped or rewritten between the plan and the upload fails the131 publish (`bundle_changed`) instead of publishing unvalidated bytes. Scan and132 snapshot both open sources through `O_NOFOLLOW` directory-descriptor chains133 and read from the validated handles, so a name swapped to a symlink between134 enumeration and the byte read cannot publish outside bytes. A failed135 snapshot attempt removes its partial copy.136- Objects are public and use `Cache-Control: no-cache, no-transform`. The137 `no-transform` stops the Cloudflare proxy from injecting its analytics beacon138 into HTML, which would break the byte-exact SHA check. Verification is never139 relaxed or normalized to accept a rewritten body. Never publish anything private.140141## Exit codes142143`0` ok · `2` invalid input/bundle/identity/remote, or unresolved dependencies on publish · `3` collision · `4` mc/preflight/timeout before any upload ·144`5` upload failed (partial, including a timeout or missing mc mid-upload) · `6` public verification failed. The JSON goes to stdout.145mc stderr is never echoed, and mc messages are redacted.146147## Do not148149Create buckets, change bucket policy, run `mc alias list`, read mc config or150credential files, use `mc mirror --remove`, or delete objects.151152Sample bundle for a live check: `assets/sample-bundle/`. Its page shows153CSS/Image/JavaScript status lines, and all three should turn green. It declares a154relative favicon so the browser doesn't request the bucket-root `/favicon.ico`155(403).156Tests: `python3 -m unittest discover -s tests -v` (from this directory).