Commands & CLI Flags
Commands Reference
JSON Layer
| Command | Alias | Description |
|---|---|---|
generateJson | gen:json | Fetch API metadata → create JSON v0 |
generateJsonAll | — | Fetch API metadata for all entities in bundle |
generateJsonMigration | — | Create / refresh changes.json template for an entity |
generateJsonMigrationAll | — | Refresh changes.json for all entities |
checkJsonChanges | check:json | Preview what current changes.json will do |
checkJsonChangesAll | check:json all | Preview changes for all entities |
matchScraperFields | match:scraper | Match with legacy scraper data, create new version |
matchScraperFieldsAll | match:scraper all | Batch scraper matching |
listJsonVersions | — | List all JSON versions for an entity |
TSX Layer
| Command | Alias | Description |
|---|---|---|
generateTsx | gen:tsx | Generate TSX from JSON version |
generateTsxAll | gen:tsx all | Generate TSX for all entities |
generateTsxMigration | — | Create TSX changes.json template |
applyTsxChanges | apply:tsx | Copy previous TSX → new version (for manual edits) |
checkTsxChanges | check:tsx | Preview TSX changes |
listTsxVersions | — | List all TSX versions for an entity |
Preview & Validation
| Command | Alias | Description |
|---|---|---|
previewChanges | preview:changes, preview | Full preview of what changes.json will produce |
validateChanges | validate:changes | Validate field references exist in API data |
validateEntity | validate | Check JSON–TSX consistency |
validateJson | validate:json | Validate JSON layer only |
validateTsx | validate:tsx | Validate TSX layer only |
validateAll | — | Validate every entity in bundle |
Pipeline & Utilities
| Command | Alias | Description |
|---|---|---|
generateVersioned | — | Full pipeline: JSON + TSX for all entities |
exportEntity | — | Copy generated TSX to destination folder |
generateTableNames | gen:table-names | Build config/tableNames.js from all versioned data |
generateEntityNames | gen:entity-names | Build config/entityNames.js from all versioned data |
token | oauth2token, oauth2 | Fetch OAuth2 token → save to config/token.txt |
CLI Flags
Core
| Flag | Description |
|---|---|
--entity | Entity path: BundleName/EntityName |
--bundleCrud | Bundle: phprCrud ticketCrud configCrud accountCrud |
--baseUrl | API base URL (required for fetch commands) |
--devUsername / --devPassword | Credentials for token generation |
Versioning
| Flag | Description |
|---|---|
--fromVersion | Base version for incremental generation (e.g. v0) |
--jsonVersion | JSON version to read when generating TSX (e.g. v1) |
--tsxVersion | Specific TSX version to use |
--version | Generic version selector |
--layer | Target layer: json or tsx (default json) |
Caching
Cache flags are mutually exclusive — use only one per command.
| Flag | Description |
|---|---|
--generateFromApi | Always fetch fresh from API, ignore cache |
--generateFromCache | Use cache when available, fallback to API |
--generateCacheOnly | Update cache only — skip TSX generation |
Other
| Flag | Description |
|---|---|
--dryRun | Preview without writing any files |
--destination | Export destination path |
--debug / -d | Print debug information |
Batch Operations
Generate Everything
# JSON only — all entities in bundle
./index.js generateJsonAll \
--bundleCrud=phprCrud \
--baseUrl=https://demo.phpreaction.com/open-api/v3
# JSON + TSX — full pipeline for all entities
./index.js generateVersioned \
--bundleCrud=phprCrud \
--baseUrl=https://demo.phpreaction.com/open-api/v3Validate Everything
./index.js validateAll \
--bundleCrud=phprCrud \
--baseUrl=https://demo.phpreaction.com/open-api/v3Preview All Changes
./index.js check:json all \
--bundleCrud=phprCrud \
--baseUrl=https://demo.phpreaction.com/open-api/v3Shell Scripts (Per Project)
PHPReaction
# All entities — legacy mode
./scripts/generate-phpr-entities.sh legacy
# All entities — versioned
./scripts/generate-phpr-entities.sh versioned
# Single entity
./scripts/generate-phpr-entities.sh versioned-entity AccountingBundle/AccountTroubleshooting
| Problem | Solution |
|---|---|
Entity not found | Check format: BundleName/EntityName — no spaces, exact casing |
Unauthorized (401) | Re-run token command — token may have expired |
API connection error | Verify --baseUrl is reachable from your machine |
tag already exists in changes.json | Run validate:changes — field was removed from API |
MANY_TO_MANY field in form | Expected — excluded automatically; check sideboxFields instead |
TSX generation fails | Run listJsonVersions to confirm JSON version exists |
Export fails | Check destination path exists and is writable |
Cache stale / wrong fields | Clear cache and re-run with --generateFromApi |
Multiple cache flag error | Use only one of --generateFromApi, --generateFromCache, --generateCacheOnly |
changes.json wiped on new version | It is not — old customizations are merged automatically |
Last updated on