sync
andurel sync refreshes derived files from a source of truth. It does not create application-owned domain files; that is generate.
When to sync versus generate
| Need | Command |
|---|---|
| New model, controller, job, email, scaffold, migration | andurel generate ... |
Refresh *_templ.go, narsilc clients, routes.ts, payloads, email CSS, factories |
andurel sync ... |
| Drift check without writing | andurel sync factory NAME --check / sync factories --check |
Generate creates or updates owned Go/SQL/frontend sources. Sync recompiles or regenerates artifacts those sources imply. After editing models/queries/*.sql, run sync queries. After adding an Inertia route marker, run sync routes. After changing payload structs, run sync payloads.
andurel tool sync downloads pinned binaries from andurel.toml / andurel.lock into bin/. It is not this group.
Commands
1andurel sync views
2andurel sync queries
3andurel sync routes --json
4andurel sync payloads --json
5andurel sync email
6andurel sync factory User --check
7andurel sync factory User --sync
8andurel sync factories --check --json
9andurel sync factories --sync
| Command | Source → output |
|---|---|
views |
.templ → *_templ.go (and email compile when inputs exist) |
queries |
models/queries/*.sql → models/internal/queries Go clients |
routes |
route declarations → resources/js/routes.ts |
payloads |
controller payload structs → resources/js/types/payloads.ts |
email |
authored email templates → inlined Tailwind / renderers |
factory |
one model Entity → models/factories declaration |
factories |
every managed Entity → factories (--check or --sync required) |
Sample output
Routes:
1andurel sync routes --json
1{
2 "ok": true,
3 "data": {
4 "generated_file": "resources/js/routes.ts",
5 "generated_helpers": 13,
6 "skipped_count": 4
7 },
8 "summary": "Generated 13 route helpers to resources/js/routes.ts (4 skipped)"
9}
Payloads:
1andurel sync payloads --json
1{
2 "ok": true,
3 "data": {
4 "generated_file": "resources/js/types/payloads.ts",
5 "type_count": 5,
6 "skipped_count": 0
7 },
8 "summary": "Generated 5 payload types to resources/js/types/payloads.ts"
9}
Queries:
1andurel sync queries --json
1{
2 "ok": true,
3 "data": {
4 "action": "generate queries",
5 "files_created": [],
6 "files_updated": [],
7 "routes_added": [],
8 "commands_run": [
9 "narsilc generate",
10 "go fmt ./models/internal/queries/..."
11 ]
12 },
13 "summary": "generate queries completed with no file changes"
14}
When SQL changed, files_updated lists regenerated clients under models/internal/queries/.
Factory check:
1andurel sync factory Product --check --json
Pass --sync to rewrite managed factory regions when the Entity drifted. Prefer --json so agents can read ok, summary, and any error hint without scraping human text.
See TypeScript Sync for the Inertia-focused route and payload workflow, and Factories for factory drift checks.