The taw commandOverview

The taw command

taw: the command-line tool every TAW theme gets from taw/core. Scaffold blocks, read and write fields, move content, sync the framework and update the site.

taw is TAW's command line. You use it to scaffold blocks, read and write fields, move content between sites, keep the theme in step with the framework, and update the whole site in one step. The commands live in each theme's taw/core, as vendor/bin/taw. The taw command finds the theme you're in and runs that theme's own copy with the right PHP. It never carries the commands itself, so every site keeps its own taw/core version, and new commands arrive with composer update taw/core.

taw list              # every command this theme has
taw help content:import

The commands ship with taw/core 1.90 and later. Before that, each theme carried its own bin/taw with a fixed list of commands.

Install

taw comes with taw-fleet 1.17.0 and later. brew install Relmaur/tap/taw-fleet installs two commands, taw-fleet and taw. Update both with brew upgrade taw-fleet.

In a theme, or from anywhere

In a theme folder, or any folder under it, type the command. taw keeps your current folder, so relative paths in the arguments work:

cd wp-content/themes/awesome-company/Blocks
taw list
taw make:block Hero --type=meta

From anywhere else, name the theme with @. The short form is the theme folder name, like @john-seed, @awesome-company or @taw-theme; a site name works too. A site with two TAW themes needs both: @<site>/<theme>.

taw @awesome-company list
taw @john-seed sync
taw @taw/taw-gutenberg list

taw @… runs in the theme folder.

Which PHP it uses

On a Local site, taw uses the site's own PHP and its MySQL socket, so commands that load WordPress reach that site's database. A theme symlinked into a site counts as that site's. Anywhere else, it uses the php on your PATH.

If the site is halted, one line says so and gives the fix, then the command runs anyway. Most commands don't need the database.

… is halted, so commands that need its database will fail: taw-fleet start <slug>

Outside a theme

Outside a theme and without @, taw says taw: not in a TAW theme, lists every theme as taw @<name> next to its site, and exits with 1.

A theme without a vendor/ folder gets the same exit code and a message to run composer install there.

See what it runs

taw has no options of its own. Everything after the theme goes to the theme's command, and you get that command's output, questions and exit code. TAW_DEBUG=1 taw … prints the folder and the shell line it runs, ready to paste.

In CI or without taw-fleet

Where taw isn't installed, like CI or another machine, run vendor/bin/taw from the theme folder. It's the same command, without the PHP and site lookup:

vendor/bin/taw list

vendor/bin/taw works on one theme: the folder that holds vendor/. To point it somewhere else, set TAW_THEME_DIR.

bin/taw in older themes

Both TAW themes still have a bin/taw file. It hands over to taw/core's tool, so php bin/taw make:block Hero does the same as vendor/bin/taw make:block Hero. In a theme whose taw/core is older than 1.90, taw runs php bin/taw for you: there, bin/taw builds the old command list from whatever taw/core has.

What a theme gets

WordPress treats a folder with theme.json and a templates/ folder as a block theme, and so does taw. A classic theme (TAW Theme) gets all 33 commands. A block theme (TAW Gutenberg) gets the 6 that don't depend on the classic scaffold.

FamilyCommandsClassicBlock
Updatesupdate, upgrade, policy✓✓
Framework filesskills:sync, docs:sync✓✓
sync, configs:sync✓
Schemaschema:validate✓✓
Blocksmake:block, export:block, import:block✓
Site stateinspect, fields:get, fields:set✓
Contentcontent:export, content:import, content:diff, content:defaults✓
WordPresswp, log:tail✓
SEO and static exportseo:extract, seo:inject, export:static✓
Chatbotcontent:reindex, content:reindex-kb, rag:usage✓
Reference corporacorpus:*, catechism:*, canon-law:*✓
Iconsicons:sync✓

Every command, with its arguments and options: Command reference.

Commands that need WordPress

Some commands read or write the site's database, so they load WordPress first:

  • inspect and fields:*;
  • content:export, content:import, content:defaults, content:reindex*;
  • seo:*, export:static, rag:usage;
  • the *:install corpus commands.

They find wp-load.php by walking up from the theme folder, up to six levels. On a Local site, the site must be running. taw finds Local's database socket for you, and taw wp does the same for WordPress's own WP-CLI.

Everything else works on files alone: scaffolding, schema checks, content:diff, syncs, migrations and updates. You can run those in CI or with the site stopped.

Habits shared by every command

  • Check first, then write. Commands that change files only report until you add --apply, like skills:sync, docs:sync, configs:sync, upgrade and content:defaults. content:import previews until you add --yes.
  • --json for scripts. Most commands take it. taw-fleet and the theme CI read that output.
  • Undo is built in where data changes. content:import --undo reverses an import from its journal, and content:defaults --undo=<journal> reverses saved defaults.

Where taw runs for you

  • composer update runs the theme's pending migrations through taw/core's Composer hook. See Updating a site.
  • Theme CI runs vendor/bin/taw schema:validate in taw/core's shared workflow, and the weekly framework-sync workflow runs vendor/bin/taw sync --apply, then vendor/bin/taw upgrade --apply.
  • taw-fleet runs the theme's taw update for Update this site (u) and Update all (U), and its sync, inspect and content:import for its scaffold check, site view and content pull.

Add your own commands

A site can add commands without touching bin/, which the framework owns and replaces on sync. Write a Symfony Console command, then register it from a file the theme's composer.json autoloads:

<?php
TAW\CLI\CommandRegistry::add(fn (string $themeDir) => new App\Cli\ReportCommand($themeDir));
"autoload": { "files": ["inc/cli.php"] }

Run composer dump-autoload, then taw list to see it. The factory gets the theme folder, so the command can work on the right theme.

A registered command can't take a built-in command's name: if two names clash, taw keeps the built-in one. Pick a prefix of your own, like site:report.