Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/artifacts/configuration.md
1# Artifacts Configuration23## Worker Binding45Configure the `artifacts` binding in your Wrangler config:67```toml8[[artifacts]]9binding = "ARTIFACTS"10namespace = "default"11```1213This exposes Artifacts on `env.ARTIFACTS` inside your Worker.1415If you authenticate with `wrangler login`, current docs say Wrangler requests `artifacts:write` by default.1617## TypeScript1819Regenerate Worker types after adding the binding:2021```bash22npx wrangler types23```2425Use the generated binding type in your environment definition:2627```typescript28interface Env {29ARTIFACTS: Artifacts;30}31```3233Wrangler generates the `Artifacts` type from the binding. Treat the generated `worker-configuration.d.ts` file as the source of truth for your environment.3435## Structure Repos for Isolation3637Artifacts works best when autonomous work is isolated:38- Create one repo per agent, session, sandbox, or task when work should stay separate.39- Fork from a reviewed baseline instead of copying starter files into every new repo.40- Use branches only when collaborators share the same lifecycle and need to work in one repo.41- Use namespaces to separate environments, teams, or high-rate workloads.4243## REST Configuration4445For external systems, configure the namespace-scoped base URL and gateway JWT:4647```bash48export ARTIFACTS_NAMESPACE="default"49export ARTIFACTS_JWT="<YOUR_GATEWAY_JWT>"50export ARTIFACTS_BASE_URL="https://artifacts.cloudflare.net/v1/api/namespaces/$ARTIFACTS_NAMESPACE"51```5253Some environments also expose an `/edge/v1/api/...` base path. Verify the correct host and base path in the live docs for your Artifacts environment.5455Use environment variables or your secret manager. Do not hardcode gateway JWTs or repo tokens.5657## Repo Tokens5859Artifacts workflows usually involve repo-scoped tokens returned by `create()` or minted later through the binding or REST API.6061Keep the control plane and data plane separate:62- Use the **Workers binding** or **REST API** with a gateway JWT to create repos and mint tokens.63- Use repo-scoped tokens only for **Git operations** against the returned `remote`.6465Recommended handling:66- Mint the narrowest scope you need: `read` or `write`67- Prefer short-lived tokens for handoff between systems68- Revoke tokens that are no longer needed6970Verify the current token behavior and auth guidance in `https://developers.cloudflare.com/artifacts/` before building long-lived automation.7172## Git Consumers7374Artifacts is designed to work with standard git-over-HTTPS clients once you have a repo `remote` and an access token.7576Prefer header-based auth for local tooling so the full token stays out of the remote URL:7778```bash79git -c http.extraHeader="Authorization: Bearer $ARTIFACTS_TOKEN" clone "$ARTIFACTS_REMOTE" artifacts-clone80```8182Use a Basic-auth remote only for short-lived commands that need a self-contained URL.8384## Retrieval Checklist8586Check the live docs before relying on:87- the current Workers binding surface88- exact token formats89- availability or product status90- route details for import, fork, and token-management flows91- the correct control-plane host or `/edge/v1` base path for your environment92- platform limits or pricing93