# Develop Sonjoo

> Build Sonjoo, run the Rust and browser test suites, and work on the dashboard and agent skill.

Canonical documentation: <https://sajaddehshiri.ir/sonjoo-seo-audit/contribute/development/>

Sonjoo embeds the dashboard files from `ui/`. Edit them directly and restart
`cargo run --locked -- serve` to try changes.

The dashboard and offline HTML report share the palette in
`ui/theme.tailwind.css`. After changing the palette or Tailwind classes in
the HTML templates, regenerate `ui/theme.css` from the repository root
and include the generated file with the change. Rust embeds it at compile time.

```sh
npx --yes @tailwindcss/cli@4.3.5 -i ui/theme.tailwind.css -o ui/theme.css --minify
```

Run the Rust checks:

```sh
cargo fmt --all --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --all-targets
```

For the browser integration checks, install Python 3 and Node.js 24 to match
CI. Use the Chromium build installed by Playwright.

```sh
npm ci --prefix tests/browser
(cd tests/browser && npx playwright install chromium)
cargo build --locked
export CHROMIUM_PATH="$(cd tests/browser && node --input-type=module -e 'import { chromium } from "playwright"; console.log(chromium.executablePath())')"
SONJOO_CHROMIUM="$CHROMIUM_PATH" cargo test --locked --test browser_live -- --ignored --test-threads=1
python3 scripts/verify_entry_responses.py
python3 scripts/verify_workflows.py --playwright
```

The workflow runner starts a local fixture and a temporary dashboard. It
exercises saved reports, downloads, and HTTP access controls. The Playwright
check repeats an audit and verifies history and filtering at a narrow viewport.

## GitHub Actions checks

**Sonjoo CI** is the aggregate status to require in branch protection or a
ruleset. It runs for pull requests and merge queues. It checks that each
selected job succeeded and that every other job was intentionally skipped.
Use the aggregate status when migrating any rules that require individual jobs.

The classifier compares the complete pull request against its base and checks
the tree GitHub tests. Main pushes and merge groups use their event's commit
range. Workflow changes, unfamiliar paths, and unavailable or ambiguous diffs
run the full suite. New commits cancel superseded runs within a pull request.
Main push runs cover their own commit ranges and finish independently.

| Change                                                  | Checks selected                                                                                 |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| README, TODO, support, and known repository Markdown    | Local links and static documentation assertions                                                 |
| Documentation site                                      | Site build and browser tests, plus examples when their source or harness changes                |
| Rust and dependency changes                             | Formatting, Clippy, and all-target tests, plus dependent runtime and packaging checks           |
| Audit engine, rule fixtures, or Playwright dependencies | Chromium-backed SEO rule validation and its coverage report                                     |
| Dashboard and API                                       | Browser and HTTP workflows, plus affected CLI/API examples                                      |
| MCP implementation or SDK fixtures                      | MCP interoperability on Linux, macOS, and Windows, plus affected examples                       |
| Packaging                                               | Platform builds, checksum verification, installation tests, and affected Rust or runtime checks |
| Release tags                                            | All development, documentation, MCP, and package checks before publication                      |

Linux dashboard, rule validation, examples, and MCP checks share one runner
and Cargo target directory. The standalone documentation build uses Node.js
24\. To test routing without starting GitHub Actions, run
`python3 -B scripts/test_ci_changes.py` from the repository root. The
classifier lives in `scripts/ci_changes.py`.

The Pages workflow publishes the documentation on each push to `main`. The crawl
benchmark has a manual workflow, and the release workflow can be run manually
to build and smoke-test the package bundle for QA.

The dashboard binds to loopback. It uses a per-launch session cookie. For
local API clients, the token in `serve.json` can be sent as
`X-Sonjoo-Token`. Sonjoo stores application data in `~/.sonjoo` by default.
Set `SONJOO_HOME` to use a different directory or to isolate application state.
To relocate an existing data directory, stop Sonjoo before copying it.

## Sonjoo agent skill

Edit `plugins/sonjoo/skills/sonjoo-audit/`. Both marketplaces use this
package. Sync the project copies so the skill is also available when opening
this checkout directly in a supported client. CI compares each copy with the
package.

```sh
skill=plugins/sonjoo/skills/sonjoo-audit
cp -R "$skill" .agents/skills/
cp -R "$skill" .claude/skills/
diff -ru "$skill" .agents/skills/sonjoo-audit
diff -ru "$skill" .claude/skills/sonjoo-audit
```

Remove any deleted package files from both copies. When releasing an updated
plugin, bump the version in both manifests under `plugins/sonjoo/`.

Run the [client verification steps](https://sajaddehshiri.ir/sonjoo-seo-audit/ai/agent-skills/#verify-the-package-in-a-client)
after changing the package, installation steps, or audit workflow.
