Mark Gibbons
Published on
5 min read

Announcing Tern: the Sitecore Community CLI

Authors

Announcing Tern: an open-source, community-built replacement for the Sitecore CLI. You can find the code and all the details in the Github repository.

When I was looking into some Sitecore CLI performance issues four months ago, I found that my configuration was causing too much data to be pulled from the server. I wondered if there was more performance gains to be had on the client-side as I still wasn't overly happy with needing to wait ~15 seconds for a simple dotnet sitecore ser push that only had a few changes.

Four months is now practically ancient history when it comes to what AI agents are capable of. So I set off to re-imagine and rebuild the Sitecore CLI's capabilities from scratch, and spoiler alert - instead of needing to wait 15 seconds for a ser push, with Tern I now only need to wait about 3 seconds!

Switching to Tern is seamless - keep your sitecore.json and item .yml files — just use tern instead of dotnet sitecore.

  1. Install: dotnet tool install --global Tern.Cli
  2. Use: tern ser pull or tern ser push

Tern features

In addition to faster serialisation, I had a long wishlist of features that I wanted in the Sitecore CLI. I've been able to ship those with this first release:

Content Diff and Sync across environments

Syncing content across environments is now easier and faster than ever. Sitecore users may know that the Sitecore Package Designer was deprecated & disabled, and many solutions to that have sprung up in the form of Sitecore Marketplace Applications and other tools.

Tern supports both the Sitecore Content Transfer API as well as using standard yml item serialisation to sync content.

There's 3 new commands:

  • content diff - you supply the source and destination environment, and which module.json that defines the path(s), and a diff will render of what's different. Run the same command with --push and it will actually push the changes too.
  • content sync - similar to the above, but no diff operation runs, it just begins syncing straight away.
  • content transfer - uses the new Content Transfer API to do the transfer.

There's guidance for you and your agent in the repo about which one to use, and when.

Agent friendly features

Some of you may know I also help maintain the Sitecore Community MCP. Agents need guardrails and structured input and output, and so I've considered and built that in to Tern.

Plans are a feature for your agent, they let an agent create a plan, review what actions it will take, and then they can apply the plan. Signatures stop it overwriting items someone changed in the meantime.

Some other agent-friendly enhancements:

  • Read-only endpoints (allowWrite) — for example you can have prod as read-only.
  • --json on every command - easy for an agent to filter out information they don't need.
  • Agent skills for using Tern and switching your repo to use Tern.

But wait, there's more:

  • item get / item query without serializing.
  • item set / authoring query through the Authoring API — no Administrator needed.
  • script run if the environment has SPE Remoting enabled.
  • Publishing, indexing, resource packages, cloud commands built in — no plugins.
  • Quality of life improvements - more informational messages, nicer formatting and styling, a CLI update notification, and even more.

Performance highlights

I benchmarked Tern against the Sitecore CLI, running both tools in turn on the same project against the same CM. These numbers are from a SitecoreAI cloud environment, except ser validate and itemres create, which only run locally:

CommandSitecore CLI 7TernSpeed-up
ser pull --what-if (whole project)18.89 s1.09 s17.4×
ser push --what-if (whole project)14.27 s1.11 s12.8×
Full push in sync, content only3.92 s0.40 s9.9×
Push 10 changes (1,000 items)1.72 s0.74 s2.3×
Pull 1,000 content items2.55 s1.16 s2.2×
Push 10,000 content items in sync4.05 s1.08 s3.8×
ser validate (whole project)4.97 s0.13 s37.7×
itemres create (whole project)4.83 s0.34 s14.2×

Most of the speed comes from Tern itself: it's compiled to native code with Native AOT, so it starts in milliseconds, then it sends larger batches, reads in parallel, and skips work when nothing has changed.

It's lighter, too. Tern is a single 12.5 MB executable with no runtime to install, against the Sitecore CLI's 12 MB plus 31 MB of plugins, plus the .NET runtime. Most commands peak at 12–86 MB of memory, against 30–155 MB.

The full performance data is in the README.

All the code is .NET 10, and I'm looking forward to the .NET 11 release to see if that brings even more performance improvements.

Security

Security best-practices are a non-negotiable these days. The code and configuration guidance has been extensively reviewed by multiple agents to catch security issues. The main one to keep in mind is not to store any environment secrets in your repo. Tern has built-in support for environment variables and .env files which you can .gitignore.

Feedback

Please feel free to contact me on Slack, LinkedIn, or open a Github issue if you have any feedback. I hope you enjoy Tern!