Skip to content

CLI

hamur is the command line of the core package. Run it as bunx hamur <command>, or through the scripts of your package.json. This page lists every command, its flags and its exit codes. Getting started walks through the first ones; Dev server and Debugging go deeper on hamur dev.

hamur --help lists the commands and hamur <command> --help prints the usage of one, with the flags it takes. hamur --version prints the version of hamur.

Rules for every command

  • A command takes the app's directory as a positional argument, [root], which is . by default. init calls it [dir], docs takes a topic, and a few commands read other positionals first, as the usage line says.
  • A flag that a command does not know fails. So does a value flag with no value; --config, --set, --log-level and --mode say <flag> needs a value. Write the optional value of --open, --inspect, --inspect-brk and --analyze after =: --open=/about.
  • Output is plain lines, with no spinner.

Exit codes

CodeWhen
0the command did what it was asked. dev and build --watch end with 0 after SIGINT or SIGTERM
1any error. The last line is error: <message>, and the stack follows only with --debug. A --log-level of silent still prints that line
130hamur init was cancelled at a question with Ctrl+C or Ctrl+D; nothing was written
the platform CLI's codehamur deploy ends with the code of the wrangler, vercel, netlify or swa it ran

Some commands end with 1 for a result and not an error: typecheck and build --typecheck print Type errors: <n>, preview --check prints Check failed: <reason>, seo audit --strict prints its findings, and warm counts a 5xx answer. The sections below name them.

Options of several commands

OptionsCommands that take them
--help, --debugevery command
--config, --set, --log-leveldev, build, generate, preview, deploy, typegen, typecheck, task, down, up, db, i18n, info, routes, inspect, warm, cleanup, upgrade, agents
--cpu-prof, --cpu-prof-mddev, build, generate, preview

The command tables below list the flags that are the command's own. The options above are described in the next sections, and hamur <command> --help prints the three groups for the commands that take them.

--config, --set and --log-level

--config <file> loads that file, resolved from [root], instead of the first of hamur.config.ts, .js and .mjs. The file must end in .ts, .js or .mjs, and a missing file fails with Config file not found: <absolute path>. hamur dev restarts when the file changes. hamur info prints the file on its Config line.

--set <key>=<value> sets one config key over the config file, its layers and the rc files, and can be given more than once. The value is JSON when it reads as JSON (false, 3000, "a b", ["/"]) and the text as written when it does not. key[]=value adds one item to the array at that key. A value that the config check refuses names the flag: --set app.baseURL=https://x: app.baseURL must be a path such as "/docs/" (got "https://x"). rootDir, extends, dev and the $ blocks cannot be set this way, since they are read before the overrides apply, and a key segment of __proto__, constructor or prototype is refused. There are no --base, --outDir, --sourcemap or --minify flags: the key's own name does the job, as in --set outputDir=out and --set build.minify=false.

--log-level <level> sets the level of the [hamur] lines for this run: trace, debug, info, warn, error, fatal or silent. The flag wins over the HAMUR_LOG_LEVEL environment variable, which wins over the logLevel key of the config, which is info by default. On dev and preview the flag also sets HAMUR_LOG_LEVEL for the server they start, so one flag quiets the app's logger too. --debug raises the level to debug unless --log-level is given, and turns on the debug key.

sh
hamur build --config hamur.staging.config.ts
hamur build --set app.baseURL=/docs/ --set outputDir=out
hamur dev --set 'devServer.warmup[]=/' --set 'devServer.warmup[]=/pricing'
hamur dev --log-level warn

The rc file

An rc file holds your own settings for hamur dev and the logger, so they need no change to the app. <root>/.hamurrc is for one app and ~/.hamurrc for every app on the machine. Each line is key.path=value, read as --set reads its value, and key[]=value adds to an array. Blank lines and lines that start with # are skipped.

txt
# ~/.hamurrc
devServer.open=true
logLevel=warn
devServer.warmup[]=/
devServer.warmup[]=/pricing

Only keys under devServer, logLevel and debug are allowed. A file outside the repository must not change what a build writes, so any other key fails: .hamurrc:3: "ssr" cannot be set in an rc file; it holds developer settings (devServer, logLevel, debug); set it in hamur.config.ts. A line without = fails as .hamurrc:2: expected key=value (got "devServer.open").

From the weakest to the strongest source: the defaults, ~/.hamurrc, <root>/.hamurrc, the config file with its layers, --set, and the other flags. hamur init, create-key and warm never read an rc file, and hamur info lists the files it read under rc. An edit of an rc file does not restart hamur dev.

Which commands use the network

Hamur sends nothing you did not ask for: no usage data, no check on start. Everything not in this table, dev, build, generate, preview, typegen without a typescript.openapi URL, typecheck, info, routes, inspect, docs, add, cleanup, migrate, upgrade --fix, module add and init with the basic template included, makes no request. The registry is npm_config_registry, else https://registry.npmjs.org. A request sends the package name, the search text or the archive URL shown, and never the app's name, files, config, environment or an identifier of the machine.

CommandRequestWhy
hamur upgradeGET <registry>/hamur, then GET <registry>/@hamur%2F<name>/<version> for each @hamur/* package of the appit must know the versions and the adapter's peer ranges. --dry-run asks too, since the diff needs them
hamur module searchGET <registry>/-/v1/search?text=keywords:hamur-module+<query>&size=20the list of modules on npm is on npm. Without a network it prints the first-party matches and npm search unavailable: <reason>
hamur init --template <starter>GET <registry>/@hamur/starters/-/starters-<version>.tgzthe starters are in the @hamur/starters package. basic and list make none
hamur init --template github:…, gh:…, gitlab:…, https:…the archive URLthe template is there. HAMUR_LAYER_AUTH is sent as a bearer token to GitHub and GitLab only
hamur typegen with a typescript.openapi entry or --openapi whose source is a URLGET <source>, once per run, with accept: application/json, application/yamlthe document is there. It is saved to .hamur/openapi/<name>.json, which build and dev read without a request
hamur dev with devServer.updateCheck: trueGET https://registry.npmjs.org/hamur/latest, at most once a day, after Local:off by default; never with CI set or HAMUR_NO_UPDATE_CHECK=1
bun create hamur, bunx create-hamurthe package manager fetches create-hamur and hamurthe package manager's request, not Hamur's
hamur module add, the install step of hamur upgrade, hamur init --installthe package manager's installthe package manager's requests, not Hamur's

A request to an address you gave, or to your own machine, is not in the table: hamur warm <origin> requests that origin, hamur down --url and hamur up --url call the app you named, hamur preview --check, hamur task run and the dev server's own warmup request localhost, and hamur deploy runs the platform's CLI, which makes its own requests. bun create hamur is the one place Hamur is fetched for a person who has none.

sh
hamur upgrade --dry-run
hamur module search seo
hamur init my-app --framework react --template blog

The commands

hamur dev

Starts the dev server with hot reload. Everything it prints and reads is in Dev server.

FlagDoes
--port <n>the port, over PORT and devServer.port. A busy default port moves up to 10 ports on; a port you chose never moves, and a busy one is Port <n> is in use; pick another with --port
--host <name>the address to listen on. A bare --host is 0.0.0.0
--dotenv <file>adds an environment file, resolved from the root
--mode <name>the mode: reads .env.<name> and sets import.meta.env.MODE (Environment)
--open[=<path>]opens the Local: address once; a bare flag opens /. --open must be a path starting with "/" (got "about")
--qrprints a QR code of the first Network: address; it needs a wildcard host
--httpsserves HTTPS with a self-signed certificate
--clear-screenclears the terminal before each restart's output
--inspect[=<[host:]port>]starts each server process with Bun's inspector, 127.0.0.1:9229 by default (Debugging)
--inspect-brk[=<[host:]port>]the same, and the first process stops on its first line
--backgroundstarts the server detached, waits until it serves, prints [hamur] Local: <url>, [hamur] Dev MCP: <url> and [hamur] Log: .hamur/dev.log, and exits 0. A server that ends first prints the last 20 lines of the log and hamur dev exited with 1; see .hamur/dev.log; one that does not serve in 60 s is stopped. It cannot be combined with --inspect-brk
--debugstack traces, and the build's debug lines

Exit codes: 0 after SIGINT, SIGTERM or the q shortcut; 1 for a start that fails, on one error: <message> line. A hamur dev whose root already runs one prints already running at <url> and exits 0.

Every hamur dev keeps the dev lock .hamur/dev.lock, which three subcommands read. They load the config only to find buildDir and make no request; a folder named status, logs or stop is written ./status.

CommandDoes
hamur dev status [root]prints running at <url> and exits 0 (restarting at <url> (pid <n>) while it restarts), or not running and exits 1
hamur dev logs [root] [-f] [-n <count>]prints the last count lines (50 by default) of .hamur/dev.log, which only --background writes; -f (--follow) goes on until Ctrl+C. -n must be a positive integer (got "0")
hamur dev stop [root]ends the server the lock names, waits up to 10 s for its port to close, and prints stopped hamur dev (pid <n>); not running when none runs (exit 0 both)

hamur build

Builds for production into .output/ and prints the file table and the route report (Build output).

FlagDoes
--preset <id>the deploy target, over the config's preset (Deploy)
--dotenv <file>adds an environment file
--mode <name>the mode, as in dev
--typecheckruns hamur typecheck first; the build stops with exit 1 on type errors
--analyze[=text|html|json]the largest modules of each client chunk. html writes .hamur/analyze/client.html and server.html, json writes stats.json. --analyze takes html or json (got "pdf")
--insights <reports.json>adds the chunks each route loaded to --analyze=html; --insights needs --analyze=html
--forceignores the prerender store and empties the build cache
--jsonalso writes .output/report.json, the route report
--dockeralso writes a Dockerfile and a .dockerignore (Docker)
--archivealso writes .output.tar.gz and prints its size; not with --watch
--watchbuilds again on each change; Rebuilt in <n> ms. A failed build prints its error and the process stays up
--routes <patterns>builds only the pages that match, as --routes "/blog/**,!/blog/draft"; hamur deploy refuses that output
--check-linkscrawls every static route in process and runs the link rules, writing no prerendered file
--debugstack traces, every output file, the resolved route rules and the debug lines

The default bun build runs with bun .output/server/index.mjs. Build with --preset node to run it with Node.

The file table shows each file's size and gzip size. Above 50 files, the files of public/ are summed per directory: public/blog/ (3000 files).

A build error names the file, the line and the column.

Exit codes: 1 for a failed build, a failed type check, or an --analyze or --routes value that is refused.

hamur generate

Builds with the static preset and prerenders every route it reaches by following links from /. The result is .output/public/, which any static host can serve. The starter has no script for it:

sh
bunx hamur generate

It takes the flags of build except --docker and --check-links (--check-links is a hamur build flag; hamur generate checks links while it prerenders), and one more.

FlagDoes
--preset <id>as in build
--dotenv <file>as in build
--mode <name>as in build
--typecheckas in build
--analyze[=text|html|json]as in build
--insights <reports.json>as in build
--forceas in build
--jsonas in build
--archiveas in build
--watchas in build; it prerenders on each change
--routes <patterns>as in build
--debug-prerenderbuilds the server unminified with source maps, prerenders one page at a time, and stops at the first failing page with its request path and mapped stack
--debugas in build

hamur preview

Serves the built output: the server of a bun or node build, or the files of a static build. For cloudflare, vercel and netlify it prints the platform's own command and exits 0.

FlagDoes
--port <n>the port, as in dev
--host <name>the address, as in dev
--dotenv <file>adds an environment file
--mode <name>the mode
--open[=<path>]opens the Local: address once
--from <archive>serves an archive written by --archive, extracted into a temporary folder that is removed on exit. Archive not found: <path>; an archive with an unsafe path, a link or no hamur.json at its root is refused before anything is written
--debugstack traces
--checkstarts the server, requests / and every prerendered path, prints <status> <path> for each and stops. Exit 1 when an answer is 5xx or a path does not answer: Check failed: <reason>

With devServer.https set, the preview of a bun or static build serves HTTPS (HTTPS). Without a build it fails with Run hamur build first.

hamur deploy

Builds, then runs the deploy command of the preset's platform CLI that you installed: production by default, a draft with --preview (hamur deploy).

FlagDoes
--prebuiltskips the build; Nothing to deploy: <file> does not exist without one
--previewa draft, not production
--dry-runprints the command and runs nothing, and does not build
--preset <id>the target, as in build
--dotenv <file>adds an environment file
--mode <name>the mode
--debugstack traces

hamur typegen

Writes .hamur/tsconfig.json and .hamur/types/ without building, and prints Wrote <buildDir>/tsconfig.json and <buildDir>/types. It is the one command that fetches the OpenAPI document of a typescript.openapi URL, and prints Fetched <source> to <buildDir>/openapi/<name>.json ($fetch types for an external API).

FlagDoes
--openapi <name>=<source>@<baseURL>generates the types of one external API without config; repeatable. The last @ splits the source from the base. Another shape fails as --openapi must be <name>=<source>@<baseURL> (got "petstore")
--mode <name>the mode
--debugstack traces

hamur typecheck

Writes the types, then runs the app's own checker: tsc, vue-tsc or svelte-check from the app's node_modules. Exit 1 with Type errors: <n>.

FlagDoes
--mode <name>the mode
--debugstack traces

hamur info

Prints the Hamur, Bun and Node versions, the package manager, the OS, the library, the preset, the config file, the resolved directories, the modules, the layers, the rc files read, the future flags that are on and, last, any version Warnings:. A @hamur/* package a minor version away from hamur shows as @hamur/adapter-react 1.1.0 and hamur 1.2.0 are out of step; run hamur upgrade.

FlagDoes
--jsonone JSON object on one line, with the real paths
--markdownthe report in a fence, for an issue, with your home folder written ~
--copyprints the markdown and copies it with the first of pbcopy, wl-copy, xclip and clip.exe on PATH; without one it prints No clipboard command found; copy the block above
--debugstack traces

--json cannot be combined with --markdown or --copy.

hamur docs

Prints the URL of a docs page: hamur docs routing prints https://server.hamur.dev/routing, and no topic prints the site's address. It makes no request. A topic with .., a scheme or white space is Invalid topic "../x".

FlagDoes
--openalso opens it in the browser. BROWSER names the program that is run with the URL, and BROWSER=none opens nothing

hamur init

Writes a starter app into [dir]. Run it with bunx, which fetches the hamur package. Getting started builds a first app with it.

FlagDoes
--framework <id>react, vue, preact, svelte, solid, html or angular. Without a terminal and without it: Missing --framework <id> (one of: react, vue, preact, svelte, solid, html, angular)
--template <name|list|spec>basic (the default), a starter name, list, or a github:, gh:, gitlab: or https: archive
--package-manager <bun|npm|pnpm|yarn>the install command in the printed steps; the default is the tool that ran create
--installruns the install in the new app
--git-initruns git init there. Inside a repository it prints Already inside a git repository; skipped git init, and without git on PATH, git not found; skipped git init
--modules <a,b>adds modules to the app's modules and dependencies: first-party names, or scoped packages of your own. An unknown or unsupported one fails before anything is written
--forcewrites into a directory that is not empty; it keeps the text of an existing AGENTS.md outside the block and an existing .vscode/ file (Kept .vscode/settings.json)
--debugstack traces

What init writes

  • package.json with the scripts dev, build, preview, typecheck, test and postinstall (hamur typegen).
  • tsconfig.json, which references the four generated contexts (Modules).
  • hamur.config.ts with the library and the devtools.
  • app/ and server/ with a few pages and a handler (Directory structure).
  • test/app.test.ts, which builds the app and asserts that / answers 200 (Testing).
  • AGENTS.md with the agent rules block (hamur agents).
  • .vscode/settings.json, which nests a page's x.load.ts under the page, and .vscode/extensions.json with the library's official extension, if it has one.

The Vue, Svelte and Angular starters use TypeScript 6, which their type checkers need.

A template from an archive gets AGENTS.md and the .vscode/ files when it depends on one @hamur/adapter-<library>.

Answer questions instead

Without --framework, in a terminal, init asks for the library, the starter, the package manager, the install, git init and the modules. A flag you pass answers its own question.

Arrow keys move, Space selects and Enter confirms. Ctrl+C or Ctrl+D leaves with exit 130 and writes nothing.

bun create hamur my-app runs hamur init of the same version, and every argument goes to it. npm create hamur and pnpm create hamur do the same. Bun must be installed: create-hamur needs Bun; install it from https://bun.sh.

sh
bun create hamur my-app
bun create hamur my-app --framework react --template blog --modules seo,i18n --install
npm create hamur my-app

Templates

--templateWrites
basicthe default starter, which is part of hamur
listnothing: it prints each template with its description and libraries
blog, docs, api, graphql, i18n, realtime or saasthat starter, from the @hamur/starters package of the same version
github:<owner>/<repo>[/<path>][#<ref>] (or gh:), gitlab:…that folder of the repository
the https: URL of a .tar.gzthat archive
sh
bunx hamur init --template list
bunx hamur init my-blog --template blog --framework react --package-manager pnpm --git-init --install
bunx hamur init my-site --template github:acme/site/templates/shop#v2

A library that a starter is not written for fails: Starter "blog" has no vue version; it supports react, html.

In every text file of a template {{name}} becomes the app's name, and _gitignore becomes .gitignore.

A template from an archive is code you run next, so read it first. init prints the URL it downloads, and these limits hold:

  • The download may take 60 s and be 100 MB. It may unpack to 500 MB and 50 000 files.
  • An archive with an absolute path, a .. segment, a drive letter, a .git folder or a link inside the template's folder fails before anything is written: Template archive "gh:acme/site#v2" has an unsafe path "../x".

A directory that is not empty

init refuses a directory that is not empty. With --force it replaces the files the template has, package.json included, and leaves your other files alone. It never writes through a symbolic link.

hamur add

hamur add <template> <name> [root] writes one file from a template, in the extension and form of your library, and prints Wrote <path>. The templates are page, layout, middleware, plugin, component, error, loader, handler, layer, module and tool.

sh
hamur add page users/[id] --loader
hamur add handler todos --route /api/todos --method post
hamur add layout admin
hamur add layer shared
FlagDoes
--forcereplaces files that exist; otherwise <path> exists; pass --force to replace it, exit 1 and nothing is written
--route <path>the route of a handler; it starts with /
--method <name>the method of a handler: get, post, put, patch, delete or query. Another method than get and post needs --route
--loaderwith page, also writes the .load.ts file
--debugstack traces
TemplateWrites
pageapp/pages/<name>.<ext>
loaderthe .load.ts file of a page that exists
layoutapp/layouts/<name>.<ext>
componentapp/components/<name>.<ext>
pluginapp/plugins/<name>.ts
middlewareapp/middleware/<name>.ts. It prints the line that imports it; nothing runs the file until a page or a _meta.ts does
handlerserver/<name>.ts, and its export in server/index.ts
layerlayers/<name>/hamur.config.ts, and its path in extends of the config
modulemodules/<name>.ts, and its import in modules of the config
errorthe error page; it takes no name
toola tool for browser agents; it needs experimental.webmcp

A name may hold folders, and each is made. Every file imports each name it uses.

layer and module edit a config that is export default defineConfig({ … }) with an object literal. With another one they write nothing, and you add the path yourself.

hamur module

hamur module add <name...> installs modules and lists them in modules of hamur.config.ts. hamur module search [query] lists the first-party modules, then the npm packages with the keyword hamur-module (one request, see above). Both run in the current directory.

sh
hamur module search i18n
hamur module add i18n --dry-run
hamur module add i18n @acme/seo

A name is the short name of a first-party module (i18n is @hamur/i18n) or any package name. A local file is listed in modules by hand.

FlagDoes
--dry-runwith add: prints the diffs of hamur.config.ts and package.json and changes nothing
--no-installwith add: writes the dependency into package.json and skips the install
--jsonwith search: prints { firstParty, registry, error? }
--debugstack traces

A first-party module that does not support your library is refused: @hamur/alpine supports html; this app uses react. A failed install exits 1 and leaves the config untouched.

add installs with the package manager of your lockfile, or bun add without one. Then it adds the import and the modules entry to the config. @hamur/i18n is already in modules changes nothing. A config that is not export default defineConfig({ … }) is left alone, and the command prints the import to add yourself.

hamur upgrade

Moves hamur and every @hamur/* package of package.json to one version, ^<version>, raises your library's range when the new adapter needs it (react ^18.3.1 becomes ^19.3.0), runs the install, removes .hamur/ (or keeps it, with Kept .hamur/: hamur dev runs there (pid <n>); run hamur dev stop and hamur cleanup, while hamur dev runs there) and prints hamur 1.1.0 → 1.2.0 per change and the changelog link. It loads no config, so it runs when the installed set does not load.

FlagDoes
--to <version|latest|next>the target; latest by default
--majorallows a new major, or a move back. Without it a new major is hamur 2.0.0 is a new major; read <changelog> and run hamur upgrade --major
--dry-runprints the diff of package.json and the changes as would change …; changes and removes nothing
--no-installskips the install
--fixrewrites your uses of deprecated APIs instead of moving a version; see below
--forcewith --fix, rewrites a git work tree that has uncommitted changes
--debugstack traces

After the install, upgrade runs the installed node_modules/.bin/hamur agents, so AGENTS.md gets the new version's block, and prints its line. It prints AGENTS.md left as it is: <reason> when that cannot run, AGENTS.md not updated; run hamur agents after the install with --no-install, and with --dry-run would change AGENTS.md when the file has a block. The exit status does not change.

A hamur upgrade that changed a package ends with Then run hamur upgrade --fix to rewrite uses of deprecated APIs. Nothing to change prints Already on hamur 1.2.0 and exits 0. A registry that cannot be reached is Cannot reach <registry>: <reason>, and a failed install is Install failed: bun install exited with 1; package.json was changed, run it again, both exit 1.

sh
hamur upgrade --dry-run
hamur upgrade
hamur upgrade --to next --major
hamur cleanup

hamur upgrade --fix is a mode of its own: it moves no version, asks no registry and installs nothing, and --to, --major and --no-install are refused with it (--fix cannot be combined with --to, --major or --no-install; run hamur upgrade, then hamur upgrade --fix). Run it after hamur upgrade, so the fixes are those of the core you now have. It loads the config and reads srcDir, serverDir, shared/ and modules/ of the app, and the config file, as text. It rewrites the uses the deprecations page lists and that have a fix; the page lists none today, so the run prints No deprecated API in use. A name in a string or a comment is not a use.

It prints one line per deprecation id, create-error-status-code: 4 uses rewritten in 3 files, then one line per use it left, app/pages/x.vue:12 link-prefetch-string: prefetch is not a string literal; with nothing to do it prints No deprecated API in use. --dry-run prints a unified diff of each file and would rewrite 4 uses in 3 files, and writes nothing. Like hamur migrate --write, it refuses a git work tree with uncommitted changes (<dir> has uncommitted changes; commit them first, or pass --force), reads and checks every file before it writes the first, and writes nothing outside the app.

sh
hamur upgrade --fix --dry-run
hamur upgrade --fix

hamur migrate

hamur migrate nuxt [dir] reads a Nuxt app as text, without running it or installing anything, and writes hamur-migration.md into dir: one row for each Nuxt API, config key, module, file convention and dependency the app uses, with its Hamur equivalent, a status and the file:line of each use. A name the app uses without an import is a manual row, since Hamur has no auto-imports. It prints hamur migrate nuxt: 44 uses in 10 files: 14 same, 26 manual, 4 none, then Wrote hamur-migration.md. Migrating from Nuxt has the same table in prose.

hamur migrate next [dir] reads a Next.js app the same way: the App Router's file conventions, middleware.ts and proxy.ts, the next/* imports, the keys of next.config.* and the "use server" and "use client" directives, each with its Hamur equivalent or none. Its --write rewrites the Pages Router only: pages/** moves to app/pages/** and pages/api/** to server/api/**, next/link, next/head and next/router become Link, useHead and useRouter of @hamur/adapter-react, and getServerSideProps becomes a GET handler in server/pages/, exported from server/index.ts, with a <page>.load.ts that calls it and a page that reads its props with useData(). App Router files are reported and left as they are. Migrating from Next has the table.

hamur migrate sveltekit [dir] reads a SvelteKit app the same way: the files of src/routes/, src/hooks.*, src/params/ and src/lib/, the $app/*, $env/* and @sveltejs/kit imports, the page exports such as actions and prerender, and the keys of svelte.config.*, each with its Hamur equivalent or none. Its --write moves +page.svelte files to app/pages/**, the root +layout.svelte to app/layouts/default.svelte and src/params/** to app/params/**, turns the load of a +page.server.ts or +page.ts into a GET handler in server/pages/ with a <page>.load.ts that calls it, each exported method of a +server.ts into a raw handler in server/routes/, and goto of $app/navigation into navigateTo of @hamur/adapter-svelte. The +page.server.ts and +server.ts files it copies stay where they are. Form actions, hooks.server.ts, nested layouts and a load that reads more than params are reported and left. Migrating from SvelteKit has the table.

hamur migrate astro [dir] reads an Astro app the same way: the files of src/pages/, src/layouts/, src/components/ and src/content/, src/middleware.* and src/actions/, the astro:* imports, the Astro global of a frontmatter, the client:* and server:defer directives of a template, and the keys of astro.config.*, each with its Hamur equivalent or none. Its --write turns each exported method (GET, POST, …) of an endpoint of src/pages/ into a raw handler in server/routes/, exported from server/index.ts; the endpoint file stays where it is. .astro pages, layouts and components, content collections, middleware, actions and the config are reported and never rewritten. An endpoint that reads more than params, url and request is reported and left. Migrating from Astro has the table.

FlagDoes
--writerewrites the app: nuxt.config.ts becomes hamur.config.ts, the root folders move under app/, renamed names and the imports Nuxt added for you are written, definePageMeta becomes export const meta, and each server/api or server/routes file becomes a raw defineHandler exported from server/index.ts. It prints Rewrote 9 files, moved 8; 8 uses are left to do (hamur-migration.md), and the report's Rewrite column says done
--dry-runprints the report and writes nothing; with --write, prints a unified diff of each file instead
--forcewith --write, rewrites a git work tree that has uncommitted changes
--debugstack traces
StatusMeans
samethe same name and shape; only an import's specifier, a key's place or a file's place changes
manualthe code changes beyond that: another name or shape, or an import Nuxt added for you
noneHamur has no equivalent; the note says what to do instead

Without --write nothing but the report is written. Nothing is written outside dir; a symbolic link is not followed and is listed under Not read. --write reads and checks every file before it writes the first, refuses a git work tree with uncommitted changes (<dir> has uncommitted changes; commit them first, or pass --force), and leaves package.json alone: the report says what to install. A folder without nuxt.config.* and without nuxt in package.json is <dir> has no nuxt.config.* and no "nuxt" in package.json; is it a Nuxt app?, exit 1.

hamur agents

Writes the agent rules block of AGENTS.md, the text between <!-- hamur:begin --> and <!-- hamur:end --> that tells a coding agent where the docs of the installed version are, where pages, loaders and server code live, and how to check a change. It is the only writer of the block: hamur init and hamur upgrade run it. It loads the config, makes no request, and changes nothing outside the markers. The block names the library, its adapter and the package manager of the lockfile (bun without one), so for one version and one library every app has the same block.

FlagDoes
--checkwrites nothing; exits 1 when the block is missing or differs from this version's
CaseDoesPrints, exit
no AGENTS.mdwrites # <package name> and the blockWrote AGENTS.md, 0
AGENTS.md without markersappends a blank line and the blockWrote AGENTS.md, 0
AGENTS.md with one blockreplaces the lines from begin to endWrote AGENTS.md, or AGENTS.md is up to date and no write, 0
agentRules: falsenothingagentRules is false; AGENTS.md is left as it is, 0
--check, block missing or differentnothingAGENTS.md is out of date; run hamur agents, 1
a begin line without an end linenothingHAMUR_E0217, 1
an end line before the begin linenothingHAMUR_E0218, 1
two begin linesnothingHAMUR_E0219, 1

The file keeps its line ending (CRLF stays CRLF) and a second run is byte-identical.

hamur cleanup

Removes buildDir, outputDir and cacheDir (.hamur, .output and node_modules/.cache/hamur by default) and prints Removed <path> for each, or Nothing to clean.

FlagDoes
--dry-runprints Would remove <path> and removes nothing
--debugstack traces

It refuses, with exit 1 and before it removes anything, a directory outside the app, a symbolic link, the root itself, a directory that holds app/, server/, public/, the config file, package.json, node_modules or .git, and buildDir while hamur dev runs there (Refusing to remove .hamur: hamur dev runs there (pid <n>); run hamur dev stop). When the config does not load, it says so and uses the default directories; with --config or --set it fails instead.

hamur routes

Prints the server routes, then the pages, in the order the router matches them: the method (or PAGE), the pattern, the name and the file.

FlagDoes
--jsonthe table that hamur dev serves at /_hamur/routes
--mode <name>the mode
--debugstack traces

hamur inspect

hamur inspect <file> [root] prints a module's final text after the transform chain of a build (Devtools).

FlagDoes
--target client|serverwhich build; client by default. --target must be "client" or "server" (got "x")
--debugstack traces

hamur task

hamur task list prints the server tasks with their schedules; hamur task run <name> runs one and prints its result as one line of JSON (Tasks). It asks a running hamur dev of the root first, and otherwise runs the task in process. With tasks.queue: { driver: "db" }, hamur task failed lists the failed rows of the durable queue and hamur task retry <id> sets one due again, on the production config (Tasks).

FlagDoes
--payload <json>the payload; --payload is not JSON: <reason>
--prodruns the task in process with the config of a build, and never asks a dev server
--port <n>the port of the hamur dev to ask
--mode <name>the mode
--debugstack traces

hamur down

hamur down puts the app in maintenance mode (server.maintenance). It runs the core task hamur:down in process with the production config, as hamur task run --prod does, which needs a shared storage mount for server.maintenance.storage; with --url <origin> it POSTs <origin><baseURL>_hamur/tasks/hamur:down with the bearer token of tasks.http, read from the environment. Without server.maintenance it fails with hamur down needs server.maintenance in hamur.config.ts; the built server does not read the flag otherwise. Task names starting with hamur: are reserved.

FlagDoes
--secret <text>a path that sets the bypass cookie; hamur down --secret must be 16 to 128 characters of A-Z, a-z, 0-9, - and _
--retry-after <seconds>the Retry-After header of the 503
--allow <ip or CIDR>an address that is never refused; repeat it
--message <text>the message of the error page
--url <origin>runs the task on a deployed app; without the token: hamur down --url needs the token: tasks.http.token reads env "TASKS_TOKEN", which is not set here
--mode <name>the mode

hamur up

hamur up ends maintenance mode by running the core task hamur:up, in process or with --url as hamur down does.

FlagDoes
--url <origin>runs the task on a deployed app
--mode <name>the mode

hamur db

hamur db migrate, status and new <name> apply, list and create the SQL migrations of @hamur/db (Database). Without the module it fails with hamur db needs @hamur/db (bun add @hamur/db, then add it to modules).

FlagDoes
--connection <name>the connection to use
--prodthe production config
--mode <name>the mode
--debugstack traces

hamur i18n

hamur i18n extract [root] reads the static t(), t.rich() and useTranslation(event).t() keys of app/, the local layers and server/, writes the missing ones into locales/<defaultLocale>.json (the value is the key) and prints one line per finding: missing home.cta app/pages/index.tsx:12, unused old.title locales/en.json, dynamic app/pages/x.tsx:4, then 1 missing, 1 unused, 1 dynamic. A key kept by i18n.keepKeys is never unused. Without the module it fails with hamur i18n needs @hamur/i18n (bun add @hamur/i18n, then add it to modules); another subcommand fails with Unknown command "hamur i18n sync"; use extract. See Internationalization.

FlagDoes
--checkwrites nothing; exits 1 when a key is missing or unused
--pruneremoves the unused keys from every locale file of the app, and the objects they leave empty
--mode <name>the mode
--debugstack traces

--check with --prune fails with --check and --prune cannot be used together.

hamur create-key

Prints a new app key: base64url of 32 random bytes, on one line.

FlagDoes
--envappends HAMUR_KEY=<key> to <root>/.env and prints Wrote HAMUR_KEY to <root>/.env; when .env already sets it, prints HAMUR_KEY is already set in <root>/.env, exits 0 and changes nothing

hamur warm

hamur warm <origin> [root] fills the caches after a deploy: it sends GET for every path that .output/hamur.json lists under prerendered, isr and cached, with x-hamur-warm: 1. It prints <status> <ms> ms <path> per path, then Warmed <n> paths in <s> s, <f> failed. Exit 1 when an answer is 5xx or a request fails or takes more than 30 s.

  • cached holds the pages and GET routes without parameters whose route rule sets swr, cache or isr.
  • <origin> has no path; the paths are requested below app.baseURL.
  • Without a build it fails with Run hamur build first.
FlagDoes
--routes <file>replaces the list with the file's paths, one per line starting with /. Blank lines and lines starting with # are skipped
--concurrency <n>requests at a time; 8 by default. --concurrency must be a positive integer (got 0)
--debugstack traces

hamur seo

hamur seo audit [root] checks .output/public/**/*.html for titles, descriptions, lang, canonical links, alt text, <h1> and noindex pages in the sitemap. It needs a prerendered build (No prerendered HTML in .output/public; run hamur generate first), loads no module and makes no request.

FlagDoes
--strictexit 1 when there is any finding
--jsonprints the report as JSON
--debugstack traces

hamur build-module

Builds a module package, src/module.ts and src/runtime, into dist/ (Modules).

FlagDoes
--debugstack traces

hamur package

Builds a component library, src/lib, into dist/ and writes its exports in package.json.

FlagDoes
--debugstack traces

In a CI job

Each of these ends with 1 when it fails, so a pipeline stops at the first that does, and none of them asks a question. preview --check serves what the build before it wrote.

sh
hamur typecheck
hamur build --check-links
hamur preview --check

Commands that make no request

These run against the app on disk and nothing else. This site's tests run them against a small html app, so the output you see is the output of the code on this page.

sh
hamur add page about --loader
hamur routes
hamur info --markdown
hamur typegen
hamur cleanup --dry-run
hamur docs routing