Skip to content

[#516] Extract RPA domain into framework-independent packages#525

Merged
chelslava merged 9 commits into
mainfrom
feature/516-domain-extraction
Jun 7, 2026
Merged

[#516] Extract RPA domain into framework-independent packages#525
chelslava merged 9 commits into
mainfrom
feature/516-domain-extraction

Conversation

@chelslava

Copy link
Copy Markdown
Owner

Summary

Implementing Phase 1-4 of issue #516: Extract RPA domain into framework-independent npm packages to decouple from React Flow and enable safer XYFlow12 migration (Strategy E1 from #513).

Changes

New Packages Created

  • @rpaforge/domain-model — Framework-agnostic types (~50 LOC)

    • RpaNode, RpaEdge types
    • DiagramValidationError types
    • Zero dependencies
  • @rpaforge/codegen — Code generation (~550 LOC)

    • generatePythonCode(), generateRobotCode()
    • diagramToMermaid() for diagram visualization
    • Graph utilities: buildGraph(), findCommonMergeNode()
    • Fully decoupled from React Flow

Type Updates in Studio

Replaced 5 type-only imports of Node/Edge with RpaNode/RpaEdge:

  1. components/Common/MermaidPreview.tsx
  2. hooks/useProcess.ts
  3. utils/fileUtils.ts
  4. utils/mermaidGenerator.ts
  5. utils/templateLoader.ts

Canvas Adapter

Created src/canvas/RpaNodeAdapter.ts with bidirectional conversion between domain and React Flow types.

Configuration

  • Root package.json with npm workspaces
  • Root tsconfig.json with TypeScript project references
  • Per-package tsconfig.json configuration
  • Both packages build successfully to dist/

Verification

✅ npm install — workspaces resolved
✅ tsc --noEmit — studio type-checks
✅ domain-model package builds
✅ codegen package builds

Related

Closes #516
Related: #513

chelslava and others added 2 commits June 7, 2026 22:33
- Create @rpaforge/domain-model with RpaNode, RpaEdge types
- Create @rpaforge/codegen with Python/Mermaid code generation
- Replace 5 type-only Node/Edge imports with RpaNode/RpaEdge
- Add RpaNodeAdapter for canvas-React Flow conversion
- Configure npm workspaces and TypeScript project references
- Both packages compile successfully

Implements Phase 1-4 of #516 domain extraction strategy.
Related: #513
@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

chelslava added 7 commits June 7, 2026 22:43
- Add @rpaforge/domain-model and @rpaforge/codegen to studio dependencies
- Restore Edge and Node imports from @reactflow/core where still needed
- Ensure npm can resolve new packages in CI environment

Fixes Type check failures in Test Studio UI job.
Use TypeScript project references instead of npm dependencies.
Workspace packages are resolved via tsconfig references.
TypeScript references don't resolve module aliases during type-check.
Use local type definitions in studio instead of @rpaforge/* imports.
This is a MVP approach for immediate CI fix.
- Restore vite-env.d.ts (accidentally deleted in domain extraction commit):
  fixes __APP_VERSION__, CSS side-effect imports, ImportMeta.glob/env
- Fix MermaidPreview.tsx import path (../types → ../../types/domain-model)
  and revert nodes/edges props to Node[]/Edge[] from @reactflow/core to
  match the Layout.tsx caller and avoid RpaNode.data:unknown access errors
- Add NodeData local type in mermaidGenerator.ts and type RpaNode<NodeData>
  function params to resolve data.blockData / data.label unknown-property errors
- Remove unused Edge import from fileUtils.ts and mermaidGenerator.ts
- Remove unused RpaNode/RpaEdge import from templateLoader.ts
- Add type?: string to studio RpaNode shim (matches React Flow Node)
- Cast diagram.nodes as ProcessNode[] in useFileOperations.ts to resolve
  RpaNode.position? vs Node.position (required) structural mismatch
Replace React Flow edge properties (sourceHandle, targetHandle, type, data, style)
with RpaEdge fields (handle) in the round-trip test, matching the domain type contract.
- Add vite as workspace root devDependency so vite-plugin-electron
  can resolve it from the pnpm virtual store (fixes ERR_MODULE_NOT_FOUND)
- Add electron-winstaller to onlyBuiltDependencies in pnpm-workspace.yaml
- Add public-hoist-pattern for vite in .npmrc as additional safety net
@chelslava chelslava merged commit ca259a8 into main Jun 7, 2026
19 checks passed
@chelslava chelslava deleted the feature/516-domain-extraction branch June 7, 2026 22:23
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.

Вынос RPA-домена в фреймворк-независимые пакеты (шаг 1: domain-model + codegen)

1 participant