@@ -65,7 +65,7 @@ and set any environment variables you need there. The CLI will load this file
6565and report which keys its using. Values in your ` .env ` file will be preferred to
6666those defined in your system.
6767
68- You can also
68+ You can also pass ` --api-key ` directly as a flag to most commands.
6969
7070::: info
7171
@@ -184,14 +184,102 @@ This will save the project to `dev@app.openfn.org.yaml`
184184To change the alias, you can simply rename the file. Whatever goes before the
185185` @ ` will be treated as the alias.
186186
187+ ## Checking Out
188+
189+ You can checkout a project any time with:
190+
191+ ``` bash
192+ openfn project checkout < alias| id| uuid>
193+ ```
194+
195+ This will update your local workflows folder with the target project.
196+
197+ If a checkout will cause changes to be lost (ie, you've changed a step.js file
198+ but haven't deployed it), you will be warned. Add ` --force ` to ignore the
199+ change, or run ` openfn project clean ` to wipe and reset the ` workflows ` folder.
200+
201+ Checking out will only modify files managed by the CLI - basically workflow and
202+ step files. If you have other files in the file system (like state files or test
203+ files) they will be untouched.
204+
187205## Running workflows in projects
188206
207+ You can execute any workflow in the checked out project by name:
208+
209+ ``` bash
210+ openfn my-workflow
211+ ```
212+
213+ The CLI will find the workflow in your ` workflows ` folder and run it. You can
214+ pass state via ` -s ` and set log levels as per usual.
215+
216+ When running a workflow by name like this, you get two benefits:
217+
218+ - ** Credentials** are loaded automatically from the credential map in
219+ ` openfn.yaml ` , so you don't need to pass ` --credential-map `
220+ - ** Collections** use the server configured in ` openfn.yaml ` , so you don't need
221+ to pass ` --collections-endpoint ` or anything.
222+
189223## Deploying a Project
190224
225+ To push your local changes back to the app, run:
226+
227+ ``` bash
228+ openfn project deploy
229+ ```
230+
231+ This will take your currently checked out project and push it to the app. It
232+ will also report what has changed in the local project.
233+
234+ Before uploading, the CLI fetches the latest version of the project from the app
235+ and checks for ** divergence** — meaning it checks whether any of your
236+ locally-changed workflows have also been edited in the app since you last
237+ pulled. If they have, the deploy will fail with an error to prevent you from
238+ accidentally overwriting someone else's work.
239+
240+ If you want to push anyway, pass ` --force ` :
241+
242+ ``` bash
243+ openfn project deploy --force
244+ ```
245+
246+ To preview what would change without actually uploading anything, use
247+ ` --dry-run ` . This will log the final update payload that would be sent to the
248+ app (as a JSON structure).
249+
250+ You can deploy the checked out project as a new project on the target app by
251+ adding the ` --new ` command. This is only available if you have superuser
252+ privileges on the target instance.
253+
254+ You can also deploy the checked out project to another app project by passing
255+ its alias, id or uuid:
256+
257+ ```
258+ openfn project deploy main
259+ ```
260+
261+ If you currently have a development sandbox checked out, this would merge it
262+ straight into the main app project.
263+
264+ Note that you have to have fetched the target project locally before you can
265+ deploy it.
266+
191267## Sandboxes
192268
193269## GitHub
194270
195271## Cheatsheet
196272
197- An OpenFn project can be represented as a single yaml file
273+ | Command | Description |
274+ | ---------------------------------------- | ------------------------------------------------------------------------------ | ----- | --------------------------------------- |
275+ | ` openfn project pull <uuid> ` | Pull a project from the app for the first time |
276+ | ` openfn project pull ` | Re-pull the current project |
277+ | ` openfn project pull <uuid> --alias dev ` | Pull and set a local alias |
278+ | `openfn project fetch <alias | id | uuid` | Fetch a project without checking it out |
279+ | ` openfn project ` | List all local projects in the current working folder |
280+ | ` openfn project checkout <alias> ` | Switch to a different local project |
281+ | ` openfn project deploy ` | Deploy checked-out project to the app |
282+ | ` openfn project deploy --dry-run ` | Try a deploy but skip the upload step |
283+ | ` openfn project deploy --force ` | Force the checked out project to be uploaded, ignoring any divergence warnings |
284+ | ` openfn <workflow-name> ` | Run a workflow in the checked-out project |
285+ | ` openfn project clean ` | Delete the ` workflows ` folder and all contents, then check out the project |
0 commit comments