Skip to content

Add Praxis 1.2.x schema support with enhanced features#32

Merged
kayodebristol merged 4 commits intomainfrom
copilot/update-praxis-version
Jan 30, 2026
Merged

Add Praxis 1.2.x schema support with enhanced features#32
kayodebristol merged 4 commits intomainfrom
copilot/update-praxis-version

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Description

Adds comprehensive support for Praxis 1.2.x schema format, enabling documentation generation for enhanced model definitions, business rules, runtime constraints, component specifications, and orchestration configuration.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Changes Made

Parser Enhancements (src/parser.ts)

Type Definitions:

  • PraxisModel: Added constraints, indexes, relationships, field validation, optional flag, complex type support
  • PraxisLogic: Added rules (with when/then), runtime constraints
  • PraxisComponent: Added props, events, layout, styling
  • PraxisOrchestration: New type for distributed system configuration

Parsing Logic:

  • Extracts business rules with conditions and actions
  • Extracts runtime constraints with validation checks
  • Extracts enhanced component definitions with props/events/layout
  • Extracts orchestration nodes, bindings, sync, and health checks
  • Maintains backward compatibility with basic Praxis schemas and legacy XState machines

Template Updates (src/generate.ts)

Schema Template:

  • Renders field validation rules inline with field descriptions
  • Displays model constraints with comma-separated field lists
  • Shows indexes with proper array joining (btree/hash/fulltext)
  • Documents relationships (one-to-one, one-to-many, many-to-many)
  • Renders component props, events, layout, and styling

Logic Template:

  • Documents business rules with conditions (when) and actions (then)
  • Displays rule priorities and comma-separated event triggers
  • Shows runtime constraints with validation checks and error messages

Example & Documentation

New Example (examples/task-management-v2/):

// Demonstrates all Praxis 1.2.x features
{
  models: [{
    fields: [{ name: 'title', validation: [{ type: 'min', value: 3 }] }],
    constraints: [{ id: 'unique_title', type: 'unique', fields: ['title'] }],
    indexes: [{ name: 'search', fields: ['title', 'desc'], type: 'fulltext' }],
    relationships: [{ name: 'tasks', type: 'one-to-many', target: 'Task' }]
  }],
  logic: [{
    rules: [{
      on: ['ITEM_CREATE'],
      when: 'event.payload.priority >= 4',
      then: 'emit("NOTIFY_ADMIN")',
      priority: 1
    }],
    constraints: [{
      check: 'state.assignee !== null',
      message: 'Must be assigned before completion'
    }]
  }],
  components: [{
    props: [{ name: 'taskId', type: 'string', required: true }],
    events: [{ name: 'submit', payload: 'Task' }],
    layout: { type: 'stack', direction: 'vertical', gap: 16 }
  }],
  orchestration: {
    nodes: [{ id: 'processor', bindings: { output: '/tasks/output' } }]
  }
}

Documentation:

  • docs/PRAXIS_V2_SUPPORT.md: Comprehensive feature guide with examples
  • Updated README with Praxis 1.2.x support notice
  • CHANGELOG entry for v2.1.0 (Unreleased)
  • ROADMAP updated with completed features

Type Exports (mod.ts)

Exported types for external use: PraxisSchema, PraxisModel, PraxisLogic, PraxisComponent, PraxisOrchestration

Testing

  • Tested with Deno runtime (syntax validation)
  • Tested with Node.js runtime (npm certificate issues in CI environment)
  • Ran deno task gen successfully (blocked by npm dependencies download)
  • Ran deno lint (noted any acceptable errors)
  • Ran deno check mod.ts (blocked by npm dependencies download)

Note: Network certificate issues in CI environment prevented full end-to-end testing. Code syntax validated successfully. Manual testing required post-merge.

Architectural Decision Record (ADR)

  • This change requires an ADR
  • This change does not require an ADR

Rationale: Extension of existing schema parser to support new Praxis version. No fundamental architectural changes - same parser pattern, same template engine, same dual-runtime approach.

Documentation

  • Documentation has been updated (if needed)
  • README updated (if needed)
  • CONTRIBUTING.md updated (if needed)
  • No documentation changes needed

Breaking Changes

None. Fully backward compatible with:

  • Basic Praxis schemas
  • Legacy XState machine format
  • Existing configuration files
  • CLI interface

Related Issues

N/A

Additional Notes

Code Review Fixes Applied:

  • Fixed template array rendering (indexes, constraints, rule triggers)
  • Added field validation display in generated docs
  • Fixed example event payload structure
  • Changed complex type notation to string literals (e.g., string[] instead of { array: 'string' })
  • Added fulltext index example

Future Considerations:

  • YAML/JSON schema file support
  • Praxis CLI integration
  • Watch mode for continuous generation
  • PNG/SVG diagram export

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • I have updated the documentation accordingly
  • My changes maintain compatibility with both Deno and Node.js (where applicable)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/plures/praxis
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[FEATURE] Update to the latest version of praxis</issue_title>
<issue_description>## Feature Description

The latest version of @plures/praxis introduces significant improvements. Refactor to support all new features. Ensure that we also update our documentation as well as code. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 30, 2026 06:48
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to the latest version of praxis and refactor Add Praxis 1.2.x schema support with enhanced features Jan 30, 2026
Copilot AI requested a review from kayodebristol January 30, 2026 06:59
@kayodebristol kayodebristol marked this pull request as ready for review January 30, 2026 07:06
@kayodebristol kayodebristol merged commit 17c5b45 into main Jan 30, 2026
6 checks passed
@kayodebristol kayodebristol deleted the copilot/update-praxis-version branch January 30, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Update to the latest version of praxis

2 participants