Commands
Development
cp .env.example .env
laravel key:generate
npm install
laravel migrate
laravel devlaravel is the Laravel for Rust CLI. The equivalent is running the application binary directly: cargo run -- <command>.
Name clash with PHP's Laravel Installer
If the laravel on your PATH is PHP's Laravel Installer (laravel list shows only new and package), use cargo run -- <command> instead.
| Command | Effect |
|---|---|
laravel dev / npm run dev | Runs the server (restarted on Rust changes), a queue worker and Vite together |
cargo run -- serve | Runs only the server |
cargo run -- migrate | Runs migrations |
cargo run -- migrate:fresh | Empties the database and reruns them |
cargo run -- make:migration create_customers_table | Creates a migration |
cargo run -- route:list | Lists routes; cg's four are under /{prefix}/… |
cargo run -- cache:clear | Clears the cache: this clears every in-progress Linker instance |
cargo run -- key:generate | Generates APP_KEY: the endpoint prefix and every signed URL change |
cargo run -- list | Every command |
Tests and checks
cargo test --workspaceDB_CONNECTION=sqlite DATABASE_URL='sqlite::memory:' cargo test --workspacecargo test -p cg-component --test php_paritycargo clippy --workspace --all-targetsnpm run buildnpm run types:checkSyncing
python3 scripts/sync-php-assets.py /path/to/CGWebFrameworkSee Syncing with the PHP project.
This wiki
cd wiki && npm install && npm run devcd wiki && npm run buildbuild checks for dead links; to deploy under a subpath, set WIKI_BASE=/path/.
Audits
PHP has php artisan linker:list (lists components, methods and actions and checks them one to one). Rust has no equivalent command, so do the same with grep:
Attack surface: registered components and exposed methods
grep -rn "linker::register::<" srcgrep -rn -A1 "const ALIAS\|const METHODS" src/cgEvery METHODS line is a method the browser can call. When a PR adds a method → review its authorization and validation (checklist).
Fragment allow list
grep -rn "render::register(" srcActions: the Rust table vs the JS implementations
sed -n '/^pub const BUILTIN_ACTIONS/,/^];/p' crates/cg-component/src/runtime/linker/response.rs \
| grep -oE '"[a-z]+\.[a-zA-Z]+"' | tr -d '"' | sort -u > /tmp/rust-actions
grep -o "^register('[^']*'" resources/js/cg/linker/actions.js | sed "s/register('//;s/'//" | sort -u > /tmp/js-actions
diff /tmp/rust-actions /tmp/js-actionsCurrently the only difference is < ui.test (only on the Rust side; see Action governance).
Custom actions: every name Rust uses exists in JS
grep -rhoE 'Action::new\("[a-z0-9]+\.[a-zA-Z0-9]+"' src | sort -ugrep -rhoE "registerLinkerAction\('[^']+'" resources/js --exclude-dir=cg | sort -uHTML output as is
grep -rnE 'Html::raw|\|safe' src resources/viewsFor each hit, check that the inserted value isn't user data, or has been escaped.
Debug output
grep -rn "dbg!\|eprintln!\|println!" src