@851-labs/hunk
v0.7.0
Published
CLI for creating, pushing, updating, and deleting static Hunk sites.
Readme
Hunk CLI
List, create, organize, pull, push, watch, update, and delete static HTML, CSS, JavaScript, and assets on Hunk from your terminal.
Install
Run commands with npx:
npx @851-labs/hunk@latest <command>The installed binary is named hunk, so global installs also work:
npm install -g @851-labs/hunk@latest
hunk <command>If you use Bun, bunx @851-labs/hunk <command> also works.
Create
Create a new hunk from the current directory, or pass a directory that contains index.html:
npx @851-labs/hunk@latest create
npx @851-labs/hunk@latest create ./siteHunks are workspace-visible by default. To make a hunk public:
npx @851-labs/hunk@latest create ./site --public
npx @851-labs/hunk@latest create ./site --visibility publicSet the initial display name or URL slug when creating the hunk:
npx @851-labs/hunk@latest create ./site --name "Landing Page"
npx @851-labs/hunk@latest create ./site --name "Landing Page" --slug landing-pageIf the directory has an unlinked .hunk/config.json, create merges in the new hunk id and the Hunk config schema URL. If the directory is already linked to a hunk, create a separate new hunk with:
npx @851-labs/hunk@latest create ./site --forcePush
Push changes from the current directory, or pass a directory linked by .hunk/config.json:
npx @851-labs/hunk@latest push
npx @851-labs/hunk@latest push ./siteWatch a linked directory and push on file saves:
npx @851-labs/hunk@latest push --watch
npx @851-labs/hunk@latest push ./site --watchpush --watch performs one initial push, then debounces file changes and runs the same push flow again. Press Ctrl+C to stop watching.
Create and push validate .hunk/config.json and add the schema URL when needed. The production project config schema is hosted at:
https://hunk.851.sh/schemas/config/v1.jsonIn development, the CLI writes:
http://hunk.localhost:3000/schemas/config/v1.jsonCreate and push print the Hunk dashboard URL when deployment creation succeeds.
Login
npx @851-labs/hunk@latest loginThe CLI opens a browser login flow, then stores a CLI token in:
~/.config/hunk/config.jsonSet HUNK_CONFIG_DIR to use a different config directory.
Set HUNK_API_TOKEN for non-interactive environments where browser login is not available.
Logout
npx @851-labs/hunk@latest logoutLogout removes the saved CLI token from the config file and revokes it with the API when possible. If HUNK_API_TOKEN is set, commands can still authenticate with that environment token.
Whoami
Show the authenticated user and workspace:
npx @851-labs/hunk@latest whoamiFor scripts and automation:
npx @851-labs/hunk@latest whoami --jsonList
List all hunks in the authenticated workspace:
npx @851-labs/hunk@latest listThe default output is a compact table with the hunk id, display name, slug, visibility, and hosted URL. For scripts and automation:
npx @851-labs/hunk@latest list --jsonTo inspect the same folder tree shown in the Hunk sidebar, use:
npx @851-labs/hunk@latest folder tree
npx @851-labs/hunk@latest folder tree --jsonTree output includes stable refs like folder:folder_123 and hunk:hunk_123 for move commands.
Folders
Create, rename, delete, and inspect sidebar folders:
npx @851-labs/hunk@latest folder create "Archive"
npx @851-labs/hunk@latest folder create "Old Sites" --parent folder_123
npx @851-labs/hunk@latest folder rename folder_123 "Archive"
npx @851-labs/hunk@latest folder delete folder_123 --yesFolder commands accept raw folder IDs or folder:<id> refs. Delete requires --yes and removes the folder and its contents.
Move
Move or reorder hunks and folders in the sidebar:
npx @851-labs/hunk@latest move old-site --into folder_123
npx @851-labs/hunk@latest move old-site --root
npx @851-labs/hunk@latest move old-site --before folder:folder_123
npx @851-labs/hunk@latest move folder:folder_123 --after hunk:hunk_456Hunks can be referenced by linked directory, slug, id, or hunk:<target>. Folders must use folder:<id> when they appear as move items.
Pull
Pull the current deployment files into the current directory:
npx @851-labs/hunk@latest pullPass a linked directory, hunk slug, or hunk id as the target. Pass a second directory argument to choose where files are written:
npx @851-labs/hunk@latest pull ./site
npx @851-labs/hunk@latest pull old-site ./site
npx @851-labs/hunk@latest pull hunk_123 ./siteA single positional argument is always treated as the target. To pull the current linked directory into another directory, pass . as the target:
npx @851-labs/hunk@latest pull . ./outPull refuses to overwrite local files. Use --force to overwrite files that are present in the remote deployment:
npx @851-labs/hunk@latest pull old-site ./site --forcePull does not delete extra local files. If the destination does not already have .hunk/config.json, pull writes one that links the destination to the pulled hunk. Existing hunk config files are left unchanged.
Update
Update attributes on the hunk linked from the current directory, or pass a linked directory, hunk slug, or hunk id:
npx @851-labs/hunk@latest update --name "Landing Page"
npx @851-labs/hunk@latest update ./site --slug landing-page
npx @851-labs/hunk@latest update old-site --visibility public
npx @851-labs/hunk@latest update hunk_123 --name "Landing Page" --slug landing-pagePass at least one of --name, --slug, or --visibility. Use --name for the display name only; use --slug when the URL should change. The .hunk/config.json file is unchanged because it stores the stable hunk id.
Create, push, and update print:
https://app.hunk.851.sh/your-workspace/your-siteDelete
Delete the hunk linked from the current directory, or pass a linked directory, hunk slug, or hunk id:
npx @851-labs/hunk@latest delete --yes
npx @851-labs/hunk@latest delete ./site --yes
npx @851-labs/hunk@latest delete old-site --yes
npx @851-labs/hunk@latest delete hunk_123 --yesDelete requires --yes and permanently deletes the remote hunk and deployments. When deleting by linked directory, it also removes the local .hunk/config.json link. It does not remove site files or the .hunk directory.
Commands
hunk login [--json]
hunk logout [--json]
hunk whoami [--json]
hunk list [--json] [--query <query>]
hunk feedback <message> [--json]
hunk folder <subcommand>
hunk folder tree [--json]
hunk folder list [--json]
hunk folder create <name> [--parent <folder-id>] [--json]
hunk folder rename <folder-id> <name> [--json]
hunk folder delete <folder-id> --yes [--json]
hunk move <item...> [--into <folder-id>|--root] [--before <item-ref>|--after <item-ref>] [--json]
hunk create [dir] [--name <display-name>] [--slug <slug>] [--visibility public|workspace] [--public] [--force] [--json]
hunk pull [target] [dir] [--force] [--json]
hunk push [dir] [--watch] [--json]
hunk update [target] [--name <display-name>] [--slug <slug>] [--visibility public|workspace] [--json]
hunk delete [target] --yes [--json]CLI behavior follows the local design rules in design.md.
Supported Files
The CLI uploads all regular files in the target directory except:
.DS_Store.git.hunknode_modules
The site directory must contain index.html.
API Target
By default, the CLI talks to:
https://api.hunk.851.shYou can override this with HUNK_API_URL or by editing the apiUrl value in the CLI config file. You can override the Hunk app link base with HUNK_APP_URL or the appUrl config value.
