Skip to content

CLI Usage

Kritarth-Dandapat edited this page Jul 19, 2026 · 1 revision

CLI Usage

dkraft-publish is the publish-side CLI, published to npm as freeflow-dkraft-publisher.

Install

npm install -g freeflow-dkraft-publisher

Or run without installing:

npx freeflow-dkraft-publisher ./plan.html

Required environment variables

Variable Meaning
DK_PUBLISH_KEY Must match the Worker's SECRET_API_KEY secret
DK_PUBLISH_URL Base URL of your deployed Worker (e.g. https://freeflow.example.workers.dev)
export DK_PUBLISH_KEY="<your SECRET_API_KEY>"
export DK_PUBLISH_URL="https://<your-worker-domain>"

If either is missing, the CLI prints a setup guide and exits non-zero without attempting a network call.

Usage

dkraft-publish <file> [-s, --secure <pin>]
Arg / flag Required Description
<file> yes Path to a local HTML file (relative to CWD)
-s, --secure <pin> no Locks the published draft behind a PIN; viewers must supply ?key=<pin>

Examples

dkraft-publish ./templates/plan-template.html
dkraft-publish ./my-plan.html --secure 1234

Success output

🚀 Published successfully! View your live plan at: https://<your-worker-domain>/d/<id>

Failure modes

  • Missing env vars — prints the setup guide (see above), exits 1.
  • File not readable (access check via fs.constants.R_OK) — fails with the underlying error.
  • Empty file"Error: The target HTML file is empty."
  • Non-2xx from Worker"Upload failed (<status>): <body>" (e.g. 401 = bad DK_PUBLISH_KEY).
  • Response missing url"Upload succeeded but response was missing a URL."
  • Any other network/parse error"Failed to publish draft." plus the underlying error message.

Giving this to a coding agent

.claude/skills/freeflow-publish/SKILL.md in the repo documents this entire flow (credential checks, invocation, error interpretation) in plain language. Claude Code auto-discovers it; any other agent can be pointed at the file directly.

Related

  • API Reference for what the CLI actually calls
  • Security for what the PIN option does and doesn't protect against

Clone this wiki locally