✨ Beta: Seamless editing in your local IDE (anvil-cli)

Have you ever wanted to edit your Anvil apps locally, then test them instantly? What if you could Alt+Tab between VS Code (or Claude Code) and the Anvil Editor – with all your changes updating live?

Introducing the Anvil CLI

The new Anvil CLI supports bidirectional sync between your local machine and Anvil itself. Changes you make in Anvil appear on your local machine. Changes you make on your local machine appear in Anvil.

We know lots of you prefer to use local tools like PyCharm to edit your Python code, but still want to use the Anvil Designer for the front end. Now, you can – just install the CLI and run anvil watch, then switch back and forth as you please.

It’s great for AI.

Time to break out Claude Code on your Anvil codebase. When your local AI agent makes changes to your code, you can instantly preview it in the Anvil Designer - or hit Run and take it for a spin! Our colleagues have described it as “addictive”.

Come learn more at the Anvil User Group

I will be talking about the Anvil CLI, showing what it can do and answering questions in Wednesday’s Anvil User Group meeting! Come see what it can do, find out how it works, and more.

Sign up here to get the link:

The Anvil Users Group is back! (Mar 18th)

It’s still in beta – give us feedback!

You saw the [BETA] tag, you know what that means – we want you to try this out on your own machine and tell us how it works! If something goes wonky, please post in the Q&A forum.


Installing the CLI

On Mac / Linux:
Open a terminal and run:

curl -fsSL https://anvil.works/install-cli.sh | sh

On Windows:
Open the Command Prompt and run:

curl -fsSL https://anvil.works/install-cli.cmd -o install.cmd && install.cmd && del install.cmd

(there’s also a PowerShell option in the docs)

Using the CLI

  1. Run anvil configure to log into Anvil
  2. Run anvil checkout to choose an app and check it out locally
  3. cd into the app’s source code and run anvil watch to sync your app

Voila – every change you make in the Anvil Editor will be replicated into your local checkout, and every change you make locally will propagate to Anvil!

Try opening the same source file in VS Code and the Anvil Editor, then editing some code!

If you already have an Anvil app checked out with Git, you can use your existing checkout – just run anvil watch in that directory.

More help

To learn more and for a quick-start guide, check out the documentation:

22 Likes

This is absolutely HUGE. Just an incredibly ginormous win, especially for Claude Code. Thank you, Anvil Team!

2 Likes

“What if you could Alt+Tab between VS Code (or Claude Code)

I am definitely giving this a try!

I’m a little behind the pack on this, but in the few hours I’ve been playing with it - wow!

I’m using it with Cursor (v2 - not moved to 3 yet) and the IDE/AI combo is definitely working for me so far.

Early days, but so far a big thumbs up!

5 Likes

Not a Q&A post, sorry hahah.

Just wanted to say bless the developers for making the anvil cli. I just discovered it yesterday and the live sync makes developing and testing from my local IDE so much easier without having to constantly commit and push.

100 points.

P.S. - didn’t find the original announcement post for the cli to comment there, so feel free to remove this post if it goes against the guidelines :laughing:

3 Likes

Is there an Anvil CLI workflow for an App that already has an existing local respository, with multiple git workspaces (e.g., for master, published, and development branches)?

All of my major Apps got local repository folders long ago, for doing the kinds of searches and edits that the on-line IDE does not, and for backing up the source code and related app-specific tools and data. It would be a waste of time and effort to have the CLI try to re-create these, after I put so much work into them.

The main benefit is working smoothly between your existing local repository and the Anvil IDE.

You do not need to use anvil checkout, because you already have the apps locally. checkout is mostly for creating a new local clone.

For live syncing use anvil watch (After anvil login)

cd path/to/local/repo
anvil watch

Once anvil watch is running, local edits will sync to the app in the Anvil IDE, and compatible edits made in the Anvil IDE can sync back to your local files.

If your preferred workflow is purely Git push/pull, then the CLI may not add much today, except for cases where you want live sync while editing locally or moving between your editor and the Anvil IDE.

There are also smaller utilities that may be useful in an existing repo, for example:

anvil validate anvil.yaml
anvil validate client_code/Form1/form_template.yaml

Those are useful if you are editing Anvil YAML files locally.

2 Likes

So I would anvil watch from within, say, Base\worktrees\dev_main. Anything I need to add to my existing folder(s)? Or elsewhere (configuration files)?