Skip to content

refactor: split engine into umbrella + engine-core packages#21

Open
albertgwo wants to merge 2 commits intofeat/engine-pr8-gorules-zenfrom
feat/engine-pr9-package-split-v2
Open

refactor: split engine into umbrella + engine-core packages#21
albertgwo wants to merge 2 commits intofeat/engine-pr8-gorules-zenfrom
feat/engine-pr9-package-split-v2

Conversation

@albertgwo
Copy link
Copy Markdown
Contributor

@albertgwo albertgwo commented Mar 19, 2026

User description

Summary

  • Rename `packages/engine` → `packages/engine-core` (`@ruminaider/flowprint-engine-core`)
  • Create thin umbrella `packages/engine` (`@ruminaider/flowprint-engine`) that re-exports from engine-core and engine-gorules
  • Add `./browser` export for browser-safe subset (engine-core only)
  • Update all internal package references and dependencies

Dependency

Base: `feat/engine-pr8-gorules-zen`

PR 13 of 16 in the execution engine implementation.

Test plan

  • All packages build successfully
  • Umbrella package re-exports work correctly
  • Browser export excludes Node.js-only code
  • No circular dependencies introduced

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Split the Flowprint engine into @ruminaider/flowprint-engine-core so the parser, runner, expressions, rules, walker, security, adapters, and codegen helpers are all surfaced from a dedicated package with a browser-safe entrypoint. Provide the new @ruminaider/flowprint-engine umbrella that re-exports the core surface plus Gorules helpers while refreshing workspace metadata so downstream tools resolve the split cleanly.

TopicDetails
Engine-core exports Publish the new engine-core workspace with its own package metadata, tsconfig references, and tsup build so that all parser/runner/rules/walker/security/adapter/codegen exports plus the browser entrypoint live behind @ruminaider/flowprint-engine-core.
Modified files (4)
  • packages/engine-core/package.json
  • packages/engine-core/src/index.ts
  • packages/engine-core/tsconfig.json
  • packages/engine-core/tsup.config.ts
Latest Contributors(0)
UserCommitDate
Gorules dependency Retarget Gorules helpers and workspace dependencies to engine-core, update the Gorules tsconfig/imports/tests, and capture all new workspace lockfile artifacts so the engine-gorules helpers still wrap the Zen engine over the renamed core package.
Modified files (7)
  • packages/engine-gorules/package.json
  • packages/engine-gorules/src/__tests__/rules-evaluator.test.ts
  • packages/engine-gorules/src/__tests__/rules-translator.test.ts
  • packages/engine-gorules/src/rules-evaluator.ts
  • packages/engine-gorules/src/rules-translator.ts
  • packages/engine-gorules/tsconfig.json
  • pnpm-lock.yaml
Latest Contributors(0)
UserCommitDate
Umbrella surface Turn the existing @ruminaider/flowprint-engine package into a thin umbrella that re-exports the core package, surfaces a browser-safe entry, and points its build/tsconfig at the new workspaces so consumers keep a familiar entrypoint.
Modified files (6)
  • packages/engine/package.json
  • packages/engine/src/browser.ts
  • packages/engine/src/index.ts
  • packages/engine/tsconfig.json
  • packages/engine/tsup.config.ts
  • tsconfig.json
Latest Contributors(1)
UserCommitDate
albertgwo@gmail.comfeat-complete-the-loop...March 02, 2026
Other Other files
Modified files (75)
  • packages/engine-core/src/__tests__/codegen/activities-generator.test.ts
  • packages/engine-core/src/__tests__/codegen/codegen-edge-cases.test.ts
  • packages/engine-core/src/__tests__/codegen/integration.test.ts
  • packages/engine-core/src/__tests__/codegen/worker-generator.test.ts
  • packages/engine-core/src/__tests__/codegen/workflow-generator.test.ts
  • packages/engine-core/src/__tests__/engine/adapter.test.ts
  • packages/engine-core/src/__tests__/engine/compensation.test.ts
  • packages/engine-core/src/__tests__/engine/engine.test.ts
  • packages/engine-core/src/__tests__/engine/parallel.test.ts
  • packages/engine-core/src/__tests__/expressions/cache.test.ts
  • packages/engine-core/src/__tests__/expressions/evaluator-security.test.ts
  • packages/engine-core/src/__tests__/expressions/interpreter.test.ts
  • packages/engine-core/src/__tests__/expressions/parse-cache.test.ts
  • packages/engine-core/src/__tests__/expressions/parser-security.test.ts
  • packages/engine-core/src/__tests__/expressions/parser.test.ts
  • packages/engine-core/src/__tests__/expressions/validator-edge-cases.test.ts
  • packages/engine-core/src/__tests__/expressions/validator.test.ts
  • packages/engine-core/src/__tests__/integration/cross-package.test.ts
  • packages/engine-core/src/__tests__/rules/evaluator-browser.test.ts
  • packages/engine-core/src/__tests__/rules/evaluator.test.ts
  • packages/engine-core/src/__tests__/rules/test-runner.test.ts
  • packages/engine-core/src/__tests__/rules/walker-rules.test.ts
  • packages/engine-core/src/__tests__/runner/e2e-consultation.test.ts
  • packages/engine-core/src/__tests__/runner/evaluator.test.ts
  • packages/engine-core/src/__tests__/runner/fixtures-edge-cases.test.ts
  • packages/engine-core/src/__tests__/runner/loader.test.ts
  • packages/engine-core/src/__tests__/runner/walker-edge-cases.test.ts
  • packages/engine-core/src/__tests__/runner/walker-error-recovery.test.ts
  • packages/engine-core/src/__tests__/runner/walker.test.ts
  • packages/engine-core/src/__tests__/security/path-containment.test.ts
  • packages/engine-core/src/__tests__/security/reserved-node-ids.test.ts
  • packages/engine-core/src/__tests__/security/yaml-limits.test.ts
  • packages/engine-core/src/__tests__/walker/walk.test.ts
  • packages/engine-core/src/adapters/index.ts
  • packages/engine-core/src/adapters/plain.ts
  • packages/engine-core/src/adapters/types.ts
  • packages/engine-core/src/codegen/activities-generator.ts
  • packages/engine-core/src/codegen/index.ts
  • packages/engine-core/src/codegen/test-fixtures-generator.ts
  • packages/engine-core/src/codegen/types-generator.ts
  • packages/engine-core/src/codegen/types.ts
  • packages/engine-core/src/codegen/utils.ts
  • packages/engine-core/src/codegen/worker-generator.ts
  • packages/engine-core/src/codegen/workflow-generator.ts
  • packages/engine-core/src/engine/compiled-flow.ts
  • packages/engine-core/src/engine/engine.ts
  • packages/engine-core/src/engine/errors.ts
  • packages/engine-core/src/engine/index.ts
  • packages/engine-core/src/engine/types.ts
  • packages/engine-core/src/expressions/allowlist.ts
  • packages/engine-core/src/expressions/cache.ts
  • packages/engine-core/src/expressions/index.ts
  • packages/engine-core/src/expressions/interpreter.ts
  • packages/engine-core/src/expressions/parser.ts
  • packages/engine-core/src/expressions/types.ts
  • packages/engine-core/src/expressions/validator.ts
  • packages/engine-core/src/rules/core.ts
  • packages/engine-core/src/rules/evaluator-browser.ts
  • packages/engine-core/src/rules/evaluator.ts
  • packages/engine-core/src/rules/index.ts
  • packages/engine-core/src/rules/test-runner.ts
  • packages/engine-core/src/rules/types.ts
  • packages/engine-core/src/runner/evaluator.ts
  • packages/engine-core/src/runner/fixtures.ts
  • packages/engine-core/src/runner/index.ts
  • packages/engine-core/src/runner/loader.ts
  • packages/engine-core/src/runner/trace.ts
  • packages/engine-core/src/runner/types.ts
  • packages/engine-core/src/runner/walker.ts
  • packages/engine-core/src/security/index.ts
  • packages/engine-core/src/security/path-containment.ts
  • packages/engine-core/src/walker/index.ts
  • packages/engine-core/src/walker/types.ts
  • packages/engine-core/src/walker/walk.ts
  • packages/engine-core/vitest.config.ts
Latest Contributors(0)
UserCommitDate
This pull request is reviewed by Baz. Review like a pro on (Baz).

Rename packages/engine/ to packages/engine-core/ and update the
package name to @ruminaider/flowprint-engine-core. Update all
references in engine-gorules (dependency, imports, tsconfig) and
root tsconfig.json to point to the new location.
Create packages/engine/ as a thin umbrella that re-exports from
@ruminaider/flowprint-engine-core and @ruminaider/flowprint-engine-gorules.

Existing consumers (CLI, app) keep importing from @ruminaider/flowprint-engine
and get both core and gorules functionality. The ./browser subpath
re-exports only the browser-safe core.

GoRules evaluateExpression/evaluateExpressions are re-exported as
zenEvaluateExpression/zenEvaluateExpressions to avoid collision
with the core runner's evaluateExpression.
Comment on lines 1 to 9
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src/index.ts', 'src/rules/evaluator-browser.ts', 'src/rules/core.ts'],
entry: ['src/index.ts', 'src/browser.ts'],
format: ['esm', 'cjs'],
dts: {
compilerOptions: {
composite: false,
},
},
clean: true,
dts: true,
sourcemap: true,
clean: true,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsup no longer emits dist/rules/evaluator-browser.*, so the deep import @ruminaider/flowprint-engine/rules/evaluator-browser fails — should we re-add that entry and re-export it or add an alias?

Finding type: Breaking Changes | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

In packages/engine/tsup.config.ts around lines 1-9, the tsup entry array removed
src/rules/evaluator-browser.ts (now ['src/index.ts','src/browser.ts']), which prevents
emitting dist/rules/evaluator-browser.* and breaks callers importing the deep path
@ruminaider/flowprint-engine/rules/evaluator-browser. Restore backward compatibility by
re-adding 'src/rules/evaluator-browser.ts' to the entry array so tsup emits that file,
and/or add a compatibility re-export: either add an explicit package export/subpath in
packages/engine package.json that maps './rules/evaluator-browser' to
'./dist/rules/evaluator-browser.js' (and .d.ts), or create a small source re-export file
(e.g., src/rules/evaluator-browser.ts) that re-exports from src/browser.ts and ensure
it's included in entries. Make this change so previous deep imports continue to resolve
without runtime module-not-found errors.

Heads up!

Your free trial ends tomorrow.
To keep getting your PRs reviewed by Baz, update your team's subscription

Comment on lines +1 to +4
{
"name": "@ruminaider/flowprint-engine-core",
"version": "0.0.0",
"description": "Expression parser, dev runner, and code generator for Flowprint execution engine",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package name "@ruminaider/flowprint-engine-core" isn't in CLAUDE.md's canonical package list — should we rename it to an allowed name or update the guidelines to permit it?

Finding type: AI Coding Guidelines | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

In packages/engine-core/package.json around lines 1-4, the "name" field is set to
"@ruminaider/flowprint-engine-core", which violates the repository's canonical package
naming policy. Either (A) rename the package to one of the allowed canonical names (for
example replace the value with "@ruminaider/flowprint-engine"), update any references in
build/publish configs or workspace entries, and ensure package files
(main/module/exports) still point to the correct output; OR (B) update the team
guideline file (CLAUDE.md) to explicitly permit "@ruminaider/flowprint-engine-core" and
add a short justification and versioning/publishing rules. Make the chosen change
consistently across the repo (package.json, workspace references, and documentation) and
return the modified files and a brief commit message explaining the decision.

Heads up!

Your free trial ends tomorrow.
To keep getting your PRs reviewed by Baz, update your team's subscription

Comment on lines +1 to +4
{
"name": "@ruminaider/flowprint-engine-core",
"version": "0.0.0",
"description": "Expression parser, dev runner, and code generator for Flowprint execution engine",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New engine-core package and engine umbrella refactor lack a .changeset entry — should we add one announcing these package changes?

Finding type: AI Coding Guidelines | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

In packages/engine-core/package.json around lines 1-4, a new package
@ruminaider/flowprint-engine-core was added but there is no .changeset entry for this
PR. Add a new changeset file under .changeset (e.g.
.changeset/<short-descriptive-name>.md) that declares the new package should be released
(use a minor or appropriate bump for a new package) and also documents the change to the
umbrella package @ruminaider/flowprint-engine (use patch/minor as appropriate). In the
changeset file include a brief human-readable summary: announce the new engine-core
package and the umbrella refactor so the release tooling will pick up both package-level
changes.

Heads up!

Your free trial ends tomorrow.
To keep getting your PRs reviewed by Baz, update your team's subscription

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying flowprint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2b75325
Status: ✅  Deploy successful!
Preview URL: https://a82df751.flowprint.pages.dev
Branch Preview URL: https://feat-engine-pr9-package-spli.flowprint.pages.dev

View logs

@albertgwo
Copy link
Copy Markdown
Contributor Author

Code Review Findings

Important (80-89 confidence)

1. CLAUDE.md not updated to reflect new monorepo structure (88)

  • The "Monorepo Structure" and "Package names" sections need updating:
    • Add packages/engine-core/ as @ruminaider/flowprint-engine-core
    • Document packages/engine/ as umbrella (re-exports engine-core + engine-gorules)
    • Update dependency graph: engine-core -> schema; engine-gorules -> engine-core; engine -> engine-core + engine-gorules

2. Version manually bumped to 0.0.1 without changeset (82)

  • File: packages/engine/package.json
  • Should be driven by changesets, not manual edits. May interfere when chain merges to main.
  • Fix: Revert to 0.0.0, add changeset if needed.

3. Umbrella tsup.config.ts DTS inconsistency (81)

  • File: packages/engine/tsup.config.ts
  • Uses bare dts: true while engine-core explicitly uses dts: { compilerOptions: { composite: false } }. Since umbrella tsconfig has composite: true, may produce different declaration artifacts.
  • Fix: Match engine-core's config: dts: { compilerOptions: { composite: false } }

Positive notes

  • Correct acyclic dependency graph
  • evaluateExpression collision properly handled (aliased as zenEvaluateExpression)
  • Browser export correctly excludes Node.js-only code
  • All internal imports updated

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.

1 participant