Skip to main content

Prophet ontology tooling CLI

Project description

Prophet logo


prophet-cli

prophet-cli is the tooling package for Prophet's ontology workflow:

  1. Parse DSL (path configured via project.ontology_file)
  2. Validate model semantics
  3. Build canonical IR (.prophet/ir/current.ir.json) including versioned query_contracts
  4. Generate deterministic artifacts (gen/sql, gen/openapi, gen/turtle, gen/migrations, gen/spring-boot, gen/node-express, gen/python)
  5. Check compatibility against baseline IR

Main project repository:

Install

From PyPI:

python3 -m pip install --upgrade prophet-cli
prophet --help

From source (editable):

From repo root:

python3 -m venv .venv --system-site-packages
.venv/bin/pip install --no-build-isolation -e ./prophet-cli

Run via venv script:

.venv/bin/prophet --help

Commands

prophet init

Creates starter prophet.yaml and internal .prophet directories.

prophet init

prophet validate

Parses + validates ontology references, IDs, states/transitions, action contracts, list types, and action/event/trigger links.

prophet validate

prophet plan

Computes deterministic file changes without writing files.

prophet plan
prophet plan --show-reasons
prophet plan --json

prophet check

Runs a CI-style gate in one command:

  1. ontology validation
  2. generated output cleanliness check
  3. compatibility/version-bump check against baseline IR
prophet check
prophet check --show-reasons
prophet check --json
prophet check --against .prophet/baselines/main.ir.json

--json emits structured diagnostics for CI bots and automation.

prophet stacks

Lists supported stack ids, framework/ORM pairings, implementation status, and capability metadata. Entries come from a schema-validated stack manifest. Schema reference:

prophet stacks
prophet stacks --json

prophet hooks

Lists generated extension hook surfaces from gen/manifest/extension-hooks.json. Useful for wiring user-owned implementations against generated interfaces. Safety/reference docs:

prophet hooks
prophet hooks --json

prophet generate / prophet gen

Writes generated artifacts and current IR.

prophet generate
prophet gen
prophet gen --skip-unchanged

Also syncs generated Spring artifacts into examples/java/prophet_example_spring when present.

Stack selection is configured in prophet.yaml:

generation:
  stack:
    id: java_spring_jpa

Generator implementations are available for all declared stack ids:

  • java_spring_jpa
  • node_express_prisma
  • node_express_typeorm
  • node_express_mongoose
  • python_fastapi_sqlalchemy
  • python_fastapi_sqlmodel
  • python_flask_sqlalchemy
  • python_flask_sqlmodel
  • python_django_django_orm Allowed generation.stack keys are: id, language, framework, orm.

Equivalent tuple form is also supported:

generation:
  stack:
    language: java
    framework: spring_boot
    orm: jpa

Default generated targets:

  • sql
  • openapi
  • spring_boot
  • flyway
  • liquibase
  • manifest (generated file ownership + hashes)

Optional cross-stack target:

  • turtle -> gen/turtle/ontology.ttl

Turtle output details:

  • emits prophet.ttl-aligned triples (prophet: + std: vocabularies)
  • local namespace prefix is derived from ontology name
  • custom type constraints are emitted as SHACL NodeShape resources
  • conformance can be checked with pyshacl (see docs/reference/turtle.md)

When baseline IR differs from current IR, Prophet also emits delta migration artifacts:

  • gen/migrations/flyway/V2__prophet_delta.sql
  • gen/migrations/liquibase/prophet/0002-delta.sql
  • gen/migrations/delta/report.json

Delta SQL includes safety flags and warnings (destructive, backfill_required, manual_review) as comments. Delta report JSON includes:

  • summary counts (safe_auto_apply_count, manual_review_count, destructive_count)
  • structured findings entries with classification and optional suggestions
  • heuristic rename hints (object_rename_hint, column_rename_hint) for manual migration planning

Generated ownership manifest:

  • gen/manifest/generated-files.json
  • includes stack metadata and deterministic hashes for generated outputs

Generated extension hook manifest:

  • gen/manifest/extension-hooks.json
  • lists generated extension points (for example action handler interfaces + default classes)

Spring runtime migration wiring is auto-detected from the host Gradle project:

  • if Flyway dependency/plugin is present, Prophet syncs Flyway resources
  • if Liquibase dependency/plugin is present, Prophet syncs Liquibase resources
  • if neither is present, migration files are still generated under gen/migrations/** but not auto-wired into Spring runtime resources

prophet gen --wire-gradle

Auto-wires the current Gradle project as a multi-module setup:

  • adds :prophet_generated in settings.gradle.kts/settings.gradle
  • maps it to gen/spring-boot
  • adds app dependency implementation(project(\":prophet_generated\")) in build.gradle.kts
prophet gen --wire-gradle

Wiring is idempotent (safe to run repeatedly).

prophet generate --verify-clean

CI mode. Fails if committed generated files differ from current generation.

prophet generate --verify-clean

prophet gen --skip-unchanged

Skips no-op regeneration when the current config + IR signature matches the last successful generation cache.

  • cache file: .prophet/cache/generation.json
  • ignored when --wire-gradle is used
  • incompatible with --verify-clean
prophet gen --skip-unchanged

prophet clean

Removes generated artifacts from current project.

Default removals:

  • gen/
  • .prophet/ir/current.ir.json
  • .prophet/cache/generation.json
  • src/main/java/<base_package>/<ontology_name>/generated
  • src/main/resources/application-prophet.yml
  • src/main/resources/schema.sql (only if it looks generated)
  • src/main/resources/db/migration/V1__prophet_init.sql (if generated)
  • src/main/resources/db/migration/V2__prophet_delta.sql (if generated)
  • src/main/resources/db/changelog/** Prophet-managed generated files, including 0002-delta.sql
  • Gradle multi-module wiring for :prophet_generated in settings.gradle(.kts) and build.gradle(.kts)
prophet clean
prophet clean --verbose
prophet clean --remove-baseline
prophet clean --keep-gradle-wire

prophet version check

Compares current IR against baseline and reports compatibility + required bump.

prophet version check --against .prophet/baselines/main.ir.json

Compatibility rules used by CLI are documented in:

Expected Project Files

  • prophet.yaml
  • <your ontology file> (configured in project.ontology_file)
  • .prophet/baselines/main.ir.json
  • .prophet/ir/current.ir.json (generated)
  • gen/ (generated)

DSL Notes

  • Field types support scalars, custom types, object refs (ref(User)), lists (string[], list(string)), and reusable struct types.
  • Nested list types are supported (for example string[][], list(list(string))).
  • name "..." metadata provides human-facing display labels while technical symbols remain the wire/reference keys.
  • Description metadata supports both description "..." and documentation "...".
  • Object keys support field-level and object-level declarations:
    • key primary
    • key primary (fieldA, fieldB) (composite)
    • key display (fieldA, fieldB) (lookup/index hint)
  • SQL/Flyway/Liquibase generation emits a non-unique idx_<table>_display index when an explicit display key is declared and it is not identical to the primary key columns.
  • Node Prisma and Mongoose generation also emits non-unique display-key indexes.
  • Generated Java record component order follows DSL field declaration order.
  • Actions are not auto-implemented; generated endpoints call handler beans.
  • Generated action services (generated.actions.services.*) are the API boundary used by controllers.
  • Default generated services delegate to handler beans; generated default handler stubs throw UnsupportedOperationException until user handlers are provided.

Config (prophet.yaml)

Required keys currently used by CLI:

project:
  ontology_file: path/to/your-ontology.prophet
generation:
  out_dir: gen
  targets: [sql, openapi, turtle, spring_boot, flyway, liquibase]
  spring_boot:
    base_package: com.example.prophet
    boot_version: 3.3
compatibility:
  baseline_ir: .prophet/baselines/main.ir.json
  strict_enums: false

Note: generated Spring package root is <base_package>.<ontology_name>.

Release Prep

Development Notes

  • Entry point module: src/prophet_cli/cli.py
  • Console script: prophet
  • No-op benchmark script: scripts/benchmark_noop_generation.py
  • Spring query APIs generated by v0.1 include:
    • GET /<objects>/{id} for single-field primary keys
    • GET /<objects>/{k1}/{k2}/... for composite primary keys
    • GET /<objects> with pagination/sort only
    • POST /<objects>/query with typed filter DSL (eq, in, gte, lte, contains) for all filtering
    • list responses returned as generated *ListResponse DTOs (no raw Spring Page payload)
  • Generated Spring query layer now uses dedicated generated.mapping.*DomainMapper classes for entity-to-domain mapping.
  • Example Spring app includes both h2 (default) and postgres runtime profiles with context tests for both.

Contributing

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prophet_cli-0.21.0.tar.gz (157.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prophet_cli-0.21.0-py3-none-any.whl (186.0 kB view details)

Uploaded Python 3

File details

Details for the file prophet_cli-0.21.0.tar.gz.

File metadata

  • Download URL: prophet_cli-0.21.0.tar.gz
  • Upload date:
  • Size: 157.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prophet_cli-0.21.0.tar.gz
Algorithm Hash digest
SHA256 2606b347a13cc38161ef5411f7f0fc589963df19027e2d435c052245f54dbeab
MD5 bed6fe16296ad5bddb896a55a6406ecf
BLAKE2b-256 2f7944553758b89a108e5d74ff253eb466df173472829789db54655dabc7c630

See more details on using hashes here.

Provenance

The following attestation bundles were made for prophet_cli-0.21.0.tar.gz:

Publisher: publish-pypi.yml on Chainso/prophet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prophet_cli-0.21.0-py3-none-any.whl.

File metadata

  • Download URL: prophet_cli-0.21.0-py3-none-any.whl
  • Upload date:
  • Size: 186.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prophet_cli-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ef72edfdac0e41466362257702a4842285d85111360fb2f0a89d849d41cdf86
MD5 dd70fee476ebdf639c7e5549319cc22f
BLAKE2b-256 d7dd1125f332a4a785b3f7c09505d42c7f9ae655bfa4244af50564190f40e230

See more details on using hashes here.

Provenance

The following attestation bundles were made for prophet_cli-0.21.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Chainso/prophet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page