Skip to content

harn files

harn files url <path> [--port 4276] [--coord-root <dir>] [--raw | --viewer] [--tunnel] [--no-verify]

Mint the browser URL for an existing file under the dashboard’s coord root:

4276/harnery-dev/docs/codec-cards.html
harn files url harnery-dev/docs/codec-cards.html
harn files url docs/notes.md
# http://localhost:4276/files?path=docs%2Fnotes.md

The command sends .html and .htm files to the isolated files origin. The browser runs those files as pages, so their scripts and relative assets work. Other extensions go to the dashboard file viewer. Use --raw or --viewer to override that choice.

url accepts a repo-relative path or an absolute path inside the coord root. It resolves symlinks, refuses directories and files outside the root, and prints one URL to stdout. Before printing, it verifies that the dashboard on the selected port serves the same canonical repository root. If the dashboard is stopped, lacks the identity endpoint, or serves another repository, the command reports the cause and leaves stdout empty.

The check compares opaque SHA-256 digests; the dashboard does not return its absolute filesystem path. Use --no-verify only when you intentionally need to construct a URL while the dashboard is unavailable. The command does not start the dashboard or bypass the file server’s deny rules. The dashboard must already be running for the printed URL to work.

Port resolution matches harn web up: --port, then HARNERY_WEB_PORT, then .harnery/config.jsonc web.port, then 4276. Pass --coord-root when the file belongs to a different project.

Use localhost links only when the operator can reach the same machine. For a reader on another device, --tunnel prints the same file’s URL on a live tunnel instead:

Terminal window
harn files url docs/plans/sprint.html --tunnel
# https://<tunnel-host>/docs/plans/sprint.html

An HTML file needs a tunnel in front of the isolated files origin, because only that origin renders the page; a dashboard tunnel can show only the viewer, which displays HTML as source. Start one with the files origin as its Host header and a path scope that covers the page’s folder:

Terminal window
harn tunnel up --name pages --target 127.0.0.1:4276 \
--vhost harnery-files.localhost --allow-path /docs/plans

Other files need a dashboard tunnel whose scope covers /files, /api/file, and /_next. The command picks the newest live tunnel on the dashboard port whose Host and path scope serve the file. When none does, it prints nothing to stdout and names the tunnel up command that would.