Skip to main content

architect

Castlecraft Architect CLI: DDD & Layered Architecture Toolkit.

Usage:

$ architect [OPTIONS] COMMAND [ARGS]...

Options:

  • --env-file FILE: Path to a custom .env file to load settings from. [env var: ARCHITECT_ENV_FILE_CLI]
  • --components-base-path TEXT: Override the COMPONENTS_BASE_PATH setting. [env var: COMPONENTS_BASE_PATH]
  • --app-root-name TEXT: Override the APP_ROOT_NAME setting. [env var: APP_ROOT_NAME]
  • -v, --verbose: Enable verbose logging (DEBUG level).
  • --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL]: Set the logging level.
  • --help: Show this message and exit.

Commands:

  • version: Displays the application version.
  • revision: Manage revisions of your project...
  • state: Manage the current persisted state of your...
  • authorization: Manage authorization policies in the...
  • schema: Generate API schemas and UI configurations.
  • context: Manage and generate contextual information...

architect version

Displays the application version.

Usage:

$ architect version [OPTIONS]

Options:

  • --help: Show this message and exit.

architect revision

Manage revisions of your project architecture.

Usage:

$ architect revision [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • apply-revision-file: Applies a revision by processing a JSON...
  • list-revisions: Lists all available revision IDs.
  • get-last-applied: Gets the ID of the last applied revision.
  • apply-revision: Applies a specific revision by ID.
  • delete-revision: Deletes a specific revision by ID.
  • clean-revisions: Deletes older revisions, keeping a...
  • describe-revision: Displays the operations within a specific...
  • validate-revision-file: Validates the structure of a JSON revision...

architect revision apply-revision-file

Applies a revision by processing a JSON file containing a list of component operations.

Usage:

$ architect revision apply-revision-file [OPTIONS] OPERATIONS_FILE

Arguments:

  • OPERATIONS_FILE: Path to the JSON file containing the list of component operations. [required]

Options:

  • --dry-run: Simulate application and show intended changes without executing.
  • --help: Show this message and exit.

architect revision list-revisions

Lists all available revision IDs.

Usage:

$ architect revision list-revisions [OPTIONS]

Options:

  • --help: Show this message and exit.

architect revision get-last-applied

Gets the ID of the last applied revision.

Usage:

$ architect revision get-last-applied [OPTIONS]

Options:

  • --help: Show this message and exit.

architect revision apply-revision

Applies a specific revision by ID.

Usage:

$ architect revision apply-revision [OPTIONS] REVISION_ID

Arguments:

  • REVISION_ID: The ID of the revision to apply. [required]

Options:

  • --dry-run: Simulate application and show intended changes without executing.
  • --help: Show this message and exit.

architect revision delete-revision

Deletes a specific revision by ID.

Usage:

$ architect revision delete-revision [OPTIONS] REVISION_ID

Arguments:

  • REVISION_ID: The ID of the revision to delete. [required]

Options:

  • --help: Show this message and exit.

architect revision clean-revisions

Deletes older revisions, keeping a specified number of recent ones.

Usage:

$ architect revision clean-revisions [OPTIONS]

Options:

  • -k, --keep INTEGER RANGE: Number of most recent revisions to keep. Must be positive. [default: 3; x>=1]
  • --help: Show this message and exit.

architect revision describe-revision

Displays the operations within a specific revision.

Usage:

$ architect revision describe-revision [OPTIONS] REVISION_ID

Arguments:

  • REVISION_ID: The ID of the revision to inspect. [required]

Options:

  • --help: Show this message and exit.

architect revision validate-revision-file

Validates the structure of a JSON revision file without applying it.

Usage:

$ architect revision validate-revision-file [OPTIONS] OPERATIONS_FILE

Arguments:

  • OPERATIONS_FILE: Path to the JSON file containing the list of component operations to validate. [required]

Options:

  • --help: Show this message and exit.

architect state

Manage the current persisted state of your project components.

Usage:

$ architect state [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • sync-from-code: Discovers components from the existing...
  • snapshot: Exports the current project state (from...
  • export-json: Exports the current project state (from...
  • get-metadata: Displays metadata about the current state...

architect state sync-from-code

Discovers components from the existing codebase and updates the .state/ directory.

Usage:

$ architect state sync-from-code [OPTIONS]

Options:

  • --help: Show this message and exit.

architect state snapshot

Exports the current project state (from .state/) as a JSON revision file, suitable for architect revision apply-revision-file.

Usage:

$ architect state snapshot [OPTIONS]

Options:

  • -o, --output FILE: Optional file path to write the JSON revision output. If not provided, prints to console.
  • --help: Show this message and exit.

architect state export-json

Exports the current project state (from .state/ directory) as JSON to the console.

Usage:

$ architect state export-json [OPTIONS]

Options:

  • -o, --output FILE: Optional file path to write the JSON output. If not provided, prints to console.
  • --help: Show this message and exit.

architect state get-metadata

Displays metadata about the current state (from .state/state_metadata.json).

Usage:

$ architect state get-metadata [OPTIONS]

Options:

  • --help: Show this message and exit.

architect authorization

Manage authorization policies in the database.

Usage:

$ architect authorization [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • sync-policies: Syncs authorization policies from a file...
  • generate-model: Generates authorization model definitions...
  • generate-policy: Generates bootstrap authorization policy...
  • list-permissions: Lists all discovered permissions in the...
  • export-policies: Exports authorization policies from the...

architect authorization sync-policies

Syncs authorization policies from a file directly to the database.

Usage:

$ architect authorization sync-policies [OPTIONS]

Options:

  • -f, --policy-file FILE: Path to the policy definition file (e.g., bootstrap_policy.csv). [required]
  • --engine TEXT: Name of the authorization engine to sync policies for (e.g., 'casbin'). [default: casbin]
  • --force-clear: If set, clear all existing policies for the engine before syncing new ones.
  • --help: Show this message and exit.

architect authorization generate-model

Generates authorization model definitions (e.g., Casbin .conf) from the current state.

Usage:

$ architect authorization generate-model [OPTIONS]

Options:

  • --engine TEXT: Name of the authorization engine to generate a model definition for (e.g., 'casbin'). [default: casbin]
  • --include-scope: For Casbin: If set, and a permission has a scope, the object will be 'resource:scope'. Otherwise, it's just 'resource'.
  • -o, --output FILE: Optional file path to write the generated model. If not provided, prints to console.
  • --help: Show this message and exit.

architect authorization generate-policy

Generates bootstrap authorization policy data (e.g., Casbin CSV) from discovered permissions.

Usage:

$ architect authorization generate-policy [OPTIONS]

Options:

  • --engine TEXT: Name of the authorization engine to generate policy data for (e.g., 'casbin'). [required]
  • --engine-config FILE: Path to a YAML/JSON file containing engine-specific bootstrap configuration.
  • --grant-full-access-to TEXT: Specify a principal identifier that should be granted full access to all discovered permissions. The interpretation is engine-dependent.
  • -o, --output FILE: Optional file path to write the generated policy data. If not provided, prints to console.
  • --include-scope: If set, and a permission has a scope, the object representation might include it (e.g., 'resource:scope'). Engine-dependent.
  • --default-domain TEXT: Default domain or tenant identifier to use, if applicable to the selected engine and its policy structure. [default: *]
  • --help: Show this message and exit.

architect authorization list-permissions

Lists all discovered permissions in the project as a JSON schema.

Usage:

$ architect authorization list-permissions [OPTIONS]

Options:

  • -o, --output FILE: Optional file path to write the JSON permission schema. If not provided, prints to console.
  • --help: Show this message and exit.

architect authorization export-policies

Exports authorization policies from the database to a file or console.

Usage:

$ architect authorization export-policies [OPTIONS]

Options:

  • -o, --output FILE: Path to save the exported policies as a CSV file. Prints to console if not provided.
  • --engine TEXT: Name of the authorization engine to export policies from (e.g., 'casbin'). [default: casbin]
  • --help: Show this message and exit.

architect schema

Generate API schemas and UI configurations.

Usage:

$ architect schema [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • ui-forms: Generate Frontend Form Configurations from...
  • ui-lists: Generate list configurations (placeholder).
  • openapi: Generates the OpenAPI schema for the...

architect schema ui-forms

Generate Frontend Form Configurations from OpenAPI Spec.

Usage:

$ architect schema ui-forms [OPTIONS]

Options:

  • -s, --schemas TEXT: Specific schema names to generate configurations for.
  • -t, --tags TEXT: Generate configurations for schemas associated with these API operation tags.
  • -a, --all: Generate for all detected schemas matching conventions or having 'x-generate-ui-form'.
  • -o, --output-dir TEXT: Directory to save generated config files.
  • --help: Show this message and exit.

architect schema ui-lists

Generate list configurations (placeholder).

Usage:

$ architect schema ui-lists [OPTIONS]

Options:

  • --resource TEXT: Resource name to generate list config for. [required]
  • --help: Show this message and exit.

architect schema openapi

Generates the OpenAPI schema for the application and saves it to a JSON file.

Usage:

$ architect schema openapi [OPTIONS]

Options:

  • -o, --output FILE: File path to save the generated OpenAPI JSON schema.
  • --help: Show this message and exit.

architect context

Manage and generate contextual information about the Architect tool and projects.

Usage:

$ architect context [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • generate-tool-info: Generates a comprehensive JSON file about...
  • combine-for-llm: Combines tool info, OpenAPI spec, and...
  • generate-input-schemas: Generates a JSON file detailing the input...
  • generate-component-docs: Generates Markdown documentation for...

architect context generate-tool-info

Generates a comprehensive JSON file about the Castlecraft Architect tool itself.

Usage:

$ architect context generate-tool-info [OPTIONS]

Options:

  • -o, --output FILE: Optional file path to write the JSON output. If not provided, prints to console. Suggested name: tool_context.json
  • --help: Show this message and exit.

architect context combine-for-llm

Combines tool info, OpenAPI spec, and example state into a single JSON for LLM consumption.

Usage:

$ architect context combine-for-llm [OPTIONS]

Options:

  • -o, --output FILE: File path to save the combined JSON context. [default: architect_llm_context.json]
  • --tool-info-file PATH: Optional path to an existing tool_context.json file.
  • --openapi-file PATH: Optional path to an existing openapi.json file.
  • --state-snapshot-file PATH: Optional path to an existing state snapshot (revision format) to use as example state.
  • --component-schemas-file PATH: Optional path to an existing component_input_schemas.json file.
  • --help: Show this message and exit.

architect context generate-input-schemas

Generates a JSON file detailing the input DTO schemas for all component types.

Usage:

$ architect context generate-input-schemas [OPTIONS]

Options:

  • -o, --output FILE: Optional file path to write the JSON output. If not provided, prints to console. Suggested name: component_input_schemas.json
  • --help: Show this message and exit.

architect context generate-component-docs

Generates Markdown documentation for component types.

Usage:

$ architect context generate-component-docs [OPTIONS]

Options:

  • -o, --output-dir PATH: Directory to save the generated Markdown component documentation. [default: docs/reference/components]
  • -c, --component-type TEXT: Generate documentation for a specific component type. If not provided, generates for all.
  • --help: Show this message and exit.