upgrade()
Bring an Older Framework Project Up to the Current Layout
upgrade() updates a project made by an earlier version of Framework so it works like a new one, without touching your code, data, or notes. It first prints a plan; with dry_run = FALSE it backs up every file it rewrites to .framework/backups/<timestamp>/ (which git ignores) and applies the plan. Running it again changes nothing.
Usage
upgrade(
path = ".",
dry_run = TRUE,
backup = TRUE,
type = NULL,
move_settings = FALSE
)
Arguments
| Name | Default | Description |
|---|---|---|
| path | "." |
The project folder (default: the working directory). |
| dry_run | TRUE |
If TRUE (default), print the plan and change nothing. |
| backup | TRUE |
If TRUE (default), copy every file before it is rewritten or
removed. Skills replaced by an update are always backed up, to
|
| type | NULL |
Change the project's type: "project", "project_sensitive",
"course", "presentation", or "bare". NULL (default) keeps it. Making a
project |
| move_settings | FALSE |
If TRUE, move top-level keys of the settings file that
no environment reads ( |
Value
Invisibly, a list with actions (a data frame: step, path, change), notes, applied, and backup_location.
Details
The plan covers:
- Settings: a 1.x
config.ymlbecomessettings.yml. Missing current sections are added:tools:(Quarto and renv, from the files present) andsecurity:. Aproject_sensitiveproject, or one with the private folder layout, getssecurity: sensitive: true. Keys outsidedefault:, which Framework ignores, are reported, or moved intosettings/withmove_settings = TRUE. - Connections: the old layouts (
options: default_connection:with connections listed flat, or the empty hybrid of both) are rewritten asconnections:withdefault_database,databases, andstorage_buckets. A password written into the settings is reported (by key, never by value) and left where it is. The spec refers to it asenv("NAME"), NAME being the variable the project already uses for it (in.env, an example.env, or the code), else one made from the connection's name; the plan names it and says to set it. - Spec:
.framework/spec.jsonis written from the settings when it is missing, and refreshed when its folders, type, author, security, tools, connections, or copy of.gitignoreno longer match, sofw project push-specandcloud_register()work. It holds only whatspec.v1allows (seeinst/schema/spec.v1.json), so keys an earlierupgrade()wrote that Framework Cloud refuses (scaffold.positron,source.upgraded_from) are dropped. - .gitignore: the rules of the current template for the project's type
that it lacks (Quarto's
/.quarto/and**/*.quarto_ipynb,framework.db, private folders) and folder publishing destinations are appended in one block. No line is ever removed, and a rule that would ignore files git tracks is left out and reported. - AI files: AGENTS.md becomes the canonical context file, with
CLAUDE.md a one-line
@AGENTS.mdpointer, when CLAUDE.md held the full guide; the marked sections are regenerated. A hand-written AGENTS.md is left alone and reported. Sensitive projects get the Claude Code guards (.claude/settings.json) that keep agents out of private folders, whatever the AI settings say: folders with aprivate(or*_private) segment, folders whose key marks them private (inputs_private_raw: inputs/raw), and private render folders. The plan says when git ignores.claude/, so the guards would stay on one computer. - Skills: Framework skills that match a version the package has
shipped are updated, in the assistants' skills folders and in
.agents/skills; missing ones for the project type are added; locally edited ones are kept and listed. A project with no skills folder gets none, except that a sensitive project getsframework-sensitive-data(in its assistants' skills folder, or.claude/skills). - Quarto: missing Quarto files are created, and an existing
_quarto.ymlat most gains missing keys (seequarto_regenerate()). Custom Quarto configuration is never replaced, and per-folder_quarto.ymlfiles are kept and listed.
Examples
Not run
if (FALSE) {
upgrade("~/projects/old-study") # print the plan
upgrade("~/projects/old-study", dry_run = FALSE) # apply it
upgrade("~/projects/old-study", type = "project_sensitive") # plan making it sensitive
}