Skip to content

cwp bricks audit

shipped 1.0.0
cwp bricks audit [env] [flags]

Acts on the local site. Name an environment to act there instead.

ArgumentWhat it isDefault
[env]environment to audit (default: default_environment in cwp.yml)
FlagWhat it doesDefault
--scope <scope>narrow the scan (all | orphans | unused | theme-styles | palettes)“
--severity <level...>show only these (error, warning, info)
--fastskip the post scan. Unused findings go absentoff
--with-agentwith —dry-run on a host with no shell: install and remove the PHP agent so the plan is realoff

Plus the shared flags --json, -v, --verbose, -q, --quiet and --dry-run.

What it does

cwp bricks audit says what in the design system is broken, and what can go.

Read-only: no confirmation, no backup, no protected-environment refusal. It behaves the same against a remote as against the local site.

Not bricks status. This one looks for rot within one design system: orphan references, unused classes, variables nothing points at. It needs one site and no counterpart. bricks status compares two versions of the same design system, the site’s and the committed tree’s.

Three kinds of finding, in Bricks’ own words:

SeverityWhat it means
errorAn orphan reference: elements point at a global class id that no longer exists. Invisible in the builder and on the page.
warningA theme style with no conditions, applying everywhere.
infoAn unused class, variable or colour, and palette fragmentation.

--scope narrows the scan on the server: all, orphans, unused, theme-styles, palettes. --severity filters what the run prints, and you may repeat it.

--fast is a trap with a warning attached. It skips the pass over posts and templates. The audit computes “unused” from that pass, so a fast run reports no unused resources on a site where it checked nothing. Every --fast run says so: those findings are absent, not zero.

The exit code stays 0 even with errors. This reports on your site; it does not pass judgement on your command. Gate on the counts in --json if you want a build to fail on orphans.

Example

cwp bricks audit                     # the local site
cwp bricks audit prod                # a remote, unguarded because nothing is written
cwp bricks audit --scope unused      # only the "what can go" half
cwp bricks audit --severity error    # only what is actually broken

What it does not do

It deletes nothing, fixes nothing and touches nothing. It is the answer to a question, and acting on that answer is a separate command you have to type.