Skip to content

Repository files navigation

pxml — AI-driven code generation from structured XML specs

pxml is a monorepo containing:

PackageDescriptionnpm
@two-tech-dev/pxml-coreParser, codegen, test runner, fix loop, schema validation@two-tech-dev/pxml-core
@two-tech-dev/pxmlCLI (pxml init, pxml compile, pxml test, pxml fix, pxml validate, pxml studio)@two-tech-dev/pxml
@two-tech-dev/pxml-studioReactFlow web editor — visual graph builder, WebSocket compile, Settings, plugins@two-tech-dev/pxml-studio

Instead of writing free-form prompts, you specify your web application architecture in XML, manage modifications using a Manifest, and allow the AI to perform local self-healing repairs at minimal cost.

Why pxml?

FeatureFree-form Promptingpxml
Input formatNatural language paragraphsDeclarative XML with typed inputs/outputs/constraints
ValidationNone (discover at runtime)Schema validation before any LLM call
Execution orderAI guesses dependenciesTopological sort from <depends_on>
TestsWrite separately (or skip)<test> blocks auto-compiled to Vitest
Bug fixingRe-prompt entire fileSurgical SEARCH/REPLACE patch
Regression preventionNonebugs_history.xml attached to every fix prompt
Token costUnpredictableMeasured per-node, printed in dollars
Delivery guaranteeBest-effortTest suite must pass before fix accepted
Git auditChat transcriptsEvery spec is a file in git

Quick Start

npm install -g @two-tech-dev/pxml
pxml init
export ANTHROPIC_API_KEY="your-api-key"
pxml compile

Providers

# Anthropic (default)
pxml compile --provider anthropic --model claude-3-5-sonnet
# OpenAI
pxml compile --provider openai --model gpt-4o
# Ollama (local)
pxml compile --provider ollama --model llama3.2:latest --baseUrl http://localhost:11434

Flags

pxml compile --dry-run # show plan without AI calls
pxml compile --no-autogen-tests # skip AI test generation
pxml compile --verify # AI self-verification (2× tokens)
pxml compile --no-validate # skip per-file linter validation
pxml compile --no-build-check # skip post-codegen build verification

Commands

CommandDescription
pxml initInitialize project with sample flows and packages
pxml compile [file]Generate code from XML specs
pxml test [--node id]Run compiled test suite
pxml fix --flow nameSelf-heal failing tests (up to 3 retries)
pxml validateSchema + cross-reference validation
pxml doctorCheck environment and API keys
pxml install / pxml iInstall packages from pxml.json
pxml plugin url-git <url>Install single package from git
pxml migrateUpdate to latest pxml syntax
pxml diagnose --log <path>Analyze compile log for failure patterns

Project Structure

my-project/
├── project.xml # main config: name, stack, imports, autogen-tests
├── flows/ # node definitions grouped by feature
│ ├── auth.xml
│ ├── cart.xml
│ └── catalog.xml
├── packages/ # installed git packages
├── pxml.json # manifest: version + installed packages
├── bugs_history.xml # institutional memory for regression prevention
└── .pxml/
├── manifest.json # test results, compile state
└── layout.json # graph editor layout (pxml Studio)

Example XML

<projectname="my-app"stack="nextjs"version="0.1.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="pxml.xsd">
<importsrc="flows/blog.xml"as="blog" />
</project>
<!-- flows/blog.xml -->
<flowname="blog.write">
<nodeid="api.posts.create"type="api-route">
<meta>
<path>app/api/posts/route.ts</path>
<depends_on>db.setup</depends_on>
</meta>
<input>
<fieldname="title"type="string"required="true" />
<fieldname="content"type="string"required="true" />
</input>
<constraintverify="static">
POST returns 201 with created post; title max 200 chars
</constraint>
<test>
<given>
<bodyjson="true">
<title>Hello</title>
<content>My post</content>
</body>
</given>
<expect><status>201</status></expect>
</test>
</node>
</flow>

pxml Studio

Launch the visual graph editor with a single command:

pxml studio # starts on http://localhost:3001
pxml studio --port 8080 # custom port

A ReactFlow-based graph editor for visual pxml project management. Features:

  • Graph canvas: 6 node types (api-route, ui-component, db-model, middleware, config-file, setup-command)
  • Node creation: toolbar button (Ctrl+N) or right-click canvas → choose node type
  • Drag-to-connect: multi-handle edges (3 source + 3 target per node)
  • Draw.io-style edges: draggable waypoints, midpoint bend-points, delete button on hover
  • Property panel: 5 tabs (basic, fields, constraints, tests, meta)
  • Settings dialog: VSCode-style (Ctrl+,) — General, Appearance, Editor, Output, AI Provider, Graph
  • Compile: WebSocket streaming with real-time node status animation
  • Test/Fix/Diagnose: run tests, self-heal, analyze failures
  • Plugin manager: install packages from git URLs
  • Undo/Redo: full history stack (Ctrl+Z / Ctrl+Shift+Z)
  • Layout persistence: saved to .pxml/layout.json
  • Resizable panels: left sidebar, right properties, bottom output
  • XML import/export: bidirectional XML ↔ graph serialization
  • Monochromatic dark theme: Cursor/Grok-inspired neutral grays
image

Multi-Stack Support

pxml supports nextjs, python, rust, go — the code generator adjusts prompt guidelines and style directives based on <project stack="...">.

Regression Prevention

Document known bugs in bugs_history.xml. The compiler attaches them to every fix prompt to prevent recurrence:

<bugsxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="bugs.xsd">
<bugid="cart.badge"flow="cart.view">
Cart badge count displays 0 despite items in cart.
Always fetch from backend DB route, not localStorage.
</bug>
</bugs>

Token Usage

After every compile or fix, the CLI prints a cost summary with input/output/cached tokens and estimated dollar cost.

Editor Autocomplete

pxml validate auto-generates an enriched pxml.xsd with exact autocomplete for flows, node types, and extends targets from imported packages — no LSP configuration needed.

License

MIT

About

Prompt AI with XML to project [ALPHA]

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages