fw adopt
adopt
Make an existing folder a Framework project, without moving anything
Added in 0.4.0.
Turns DIR (default: the current folder) into a Framework project in place. fw looks at folder names only, at most three levels deep, proposes which Framework directory each one is, and lets you change a folder's role at a terminal. Without one, pass --yes after reading the proposal.
For a Stata project fw writes settings.do and .framework/spec.json and nothing else: it creates, moves, and overwrites no files, and stops if the folder is already a project. The project stays on this machine; run fw project push-spec to send its spec to Framework Cloud. Python projects are adopted by framework-py (0.1.0.dev6 or later), which fw runs for you. R projects need framework::adopt() in R for now.
fw detects the language from the files at the top of the folder (.do files for Stata, pyproject.toml for Python, renv.lock, DESCRIPTION, or an .Rproj file for R). --lang overrides it.
Usage
fw adopt [DIR] [flags]
Options
| Name | Type | Description |
|---|---|---|
| DIR | string | |
| --json | bool |
print JSON on stdout, for scripts and agents |
| --lang | string |
the project's language: r, python, or stata (default: detected) |
| -y, --yes | bool |
accept the proposed mapping without asking |
Value
With --json (and --yes), {"path", "language", "created", "directories", "extra_directories", "warnings"}. created lists the files fw wrote.
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 adopt ~/projects/old-study --lang stata
fw adopt --yes