fw project upgrade
project upgrade
Bring an older Framework project to the current layout
Added in 0.4.7.
Brings a project made by an older Framework, or adopted by one, to the current layout. Without --apply it only prints what would change.
R projects run framework::upgrade(dry_run = TRUE), or dry_run = FALSE with --apply, and Python projects run python -m framework upgrade, in the project's own environment. When the package there has no upgrade yet, fw says to update it and changes nothing.
fw upgrades Stata projects itself. It records .framework/spec.json from settings.do when missing, writes settings.yml when absent, adds the settings.do header that references settings.yml, updates master.do to check for framework-stata 0.2.0+ and run fw_scaffold when framework-stata 0.3.0+ is installed (falling back to fw_project), creates missing gitignored private folders, and appends missing .gitignore rules (omitting !... negations when existing rules are present). The spec records tools.quarto when the project has a _quarto.yml, _quarto.yaml, or .qmd file at most three folders deep. It never deletes or modifies existing lines: it only creates files, inserts lines, and appends. Modified files are backed up to .framework/backups// first unless --no-backup is passed. Running it again changes nothing.
--type changes the project's type, as R's upgrade(type =) does. To project_sensitive it turns on security: sensitive and adds the Privacy Sensitive layout's private and public folders the project lacks, keeping its own; the .gitignore rules, the private folders, and the guard that keeps Claude Code out of them follow. A sensitive project changed to another type stays sensitive. In Stata, fw adds the new folders to settings.yml and settings.do. --move-settings moves settings keys outside the environment sections into settings/.yml (R and Python). R passes them as upgrade(type =, move_settings = TRUE), which needs a framework package newer than 2.0.1, and Python as --type and --move-settings, which need a framework-py newer than 0.1.0.dev13; fw says when the package lacks them.
Usage
fw project upgrade [flags]
Options
| Name | Type | Description |
|---|---|---|
| --apply | bool |
make the changes (default: print them only) |
| --json | bool |
print JSON on stdout, for scripts and agents (Stata projects) |
| --move-settings | bool |
move settings keys outside the environment sections into settings/.yml (R and Python) |
| --no-backup | bool |
don't copy changed files to .framework/backups first |
| --type | string |
change the project's type: project, project_sensitive, course, presentation, or bare (Stata: project, project_sensitive, or bare) |
Value
With --json, for Stata projects, {"path", "language", "applied", "changes", "notes", "backup"}. Each change has file, action (create, insert, append, or update), summary, and the lines it adds.
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 project upgrade
fw project upgrade --apply
fw project upgrade --apply --no-backup
fw project upgrade --type project_sensitive
fw project upgrade --apply --move-settings