maton function deploy
maton function deploy [--dir <dir>] [flags]
Push a local source tree to Maton. The first run creates the function; every run after that publishes a new version of the same one.
Which of the two happens is decided by a link file, .maton/state.json,
written into the deployed directory on the first successful create. It records
the function ID, so no function ID ever has to be typed and no name is ever
matched against the server. Deploy resolves its target in this order:
1. --function <id>
2. MATON_FUNCTION_ID
3. .maton/state.json
4. nothing linked, so create a new function
The link file is dot-prefixed, which means the bundler already skips it and it
can never be uploaded. It is per-account, so it should not be committed —
deploy prints a reminder rather than editing your .gitignore for you.
Two flags are create-only and are refused against a linked function. --name
is refused because renaming reallocates the URL, which is a deliberate act that
belongs to maton function update --name; --runtime is refused because a
function’s runtime is immutable. When creating, the name defaults to the
directory’s own name, slugified.
Bundling, inference, and the ignore rules are the same as create; see that
command for the details. --dry-run resolves the target and prints both it and
the full manifest without uploading anything.
create and update remain available and map one-to-one onto POST and
PATCH, which is what you want from a script. For deploying code by hand, prefer
this command.
Options
-
--description <string> - Description
-D,--dir <string> (default ".")- Directory to deploy
-
--dry-run - Print the target and bundle manifest, then exit without uploading
-
--file <local[:remote]> - Extra file to include as local[:remote] (repeatable)
-
--function <string> - Deploy to this function ID, overriding any link
-
--handler <<module>.<symbol>> - Handler as <module>.<symbol> (inferred on create, unchanged otherwise)
-
--ignore <stringArray> - Glob to exclude from --dir (repeatable)
-q,--jq <expression>- Filter JSON output using a jq expression
-
--json <fields> - Output JSON with the specified fields
-
--name <string> - Name for a new function (defaults to the directory name)
-
--network-policy <string> - Whether the sandbox may reach the network: {ALLOW_ALL|DENY_ALL}
-
--no-default-ignore - Do not apply the default ignore list
-
--runtime <string> - Runtime for a new function (inferred when omitted): {python3.12|nodejs22.x}
-t,--template <string>- Format JSON output using a Go template; see "maton help formatting"
-
--visibility <string> - Who can see the function: {PRIVATE|PUBLIC|UNLISTED}
-
--yes - Create without confirmation (required when not running interactively)
Options inherited from parent commands
-p,--profile <string>- Profile to use for this invocation (overrides the active profile; also reads MATON_PROFILE)
JSON Fields
account_id, created_at, description, function_id, name, network_policy, runtime, star_count, updated_at, url, version, view_count, visibility
Examples
# Create on the first run, publish a new version on every run after
$ cd my-fn && maton function deploy
# A directory somewhere else
$ maton function deploy --dir ./services/my-fn
# See the target and the manifest without uploading
$ maton function deploy --dry-run
# Adopt a function that already exists, then deploy to it from now on
$ maton function deploy --function 9f3c1e2a-0b7d-4c11-9d2e-5f6a7b8c9d01
# Non-interactive: create without the confirmation prompt
$ maton function deploy --yes --name my-fn
# Change a setting as part of the deploy
$ maton function deploy --visibility PUBLIC