Skip to content

Cloud

fw artifacts flatten

artifacts flatten

Keep only an artifact's newest version, as version 1

Added in 0.8.9.

Makes an artifact's newest version its only one, numbered 1, and deletes the older versions and their files for good. The Trash doesn't keep them. Links and embeds of old versions open the newest one. Collections and reports pinned to an old version move to version 1. The next publish continues after the highest old number. External publications can't be flattened.

Inside a project linked to Framework Cloud, fw uses the project token in .env, as fw publish does, and flattens the project's artifact. With --project, or outside a linked project, it uses your login; --project names the project when several of yours have an artifact with this slug.

fw asks first, defaulting to No; --yes skips the question. Without a terminal, --yes is required.

Usage

fw artifacts flatten SLUG [flags]

Options

Name Type Description
SLUG required string
--json bool

print JSON on stdout, for scripts and agents

--project string

the artifact's project slug (uses your login instead of the project token)

--url string

Framework Cloud server (default: the project's FW_CLOUD_URL, then your login's)

Environment variable: FW_CLOUD_URL

-y, --yes bool

flatten without asking

Value

With --json, {"artifact", "version", "removed", "artifact_url"}: the slug, its version after flattening (1), how many older versions were deleted, and the artifact's page on Framework Cloud. A missing artifact fails with reason not_found, and a slug that several of your projects share with reason ambiguous_slug.

Exit codes

Code Meaning
0 Success
1 Failure
2 Bad flags or arguments
3 Not logged in, or the server rejected the token
4 The server has no such project or resource
5 Browser login was denied, or its code expired
6 An upload has "private" in a path; rerun with --include-private if you mean to send it

With --json, a failure also prints one JSON line on stderr: {"error": "...", "exit_code": 4}. Exit code 6 adds "reason": "private_path".

Examples

fw artifacts flatten treatment-effect
fw artifacts flatten treatment-effect --project vaccine-study --yes --json

Related reference

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.