Skip to content

refactor: split rename and reorganize files and functions#3191

Open
Iru89 wants to merge 1 commit intoBLT-2254-plugin-flow-builder-allow-go-to-flow-to-aia-gent-as-a-follow-upfrom
refactor-split-and-rename-files
Open

refactor: split rename and reorganize files and functions#3191
Iru89 wants to merge 1 commit intoBLT-2254-plugin-flow-builder-allow-go-to-flow-to-aia-gent-as-a-follow-upfrom
refactor-split-and-rename-files

Conversation

@Iru89
Copy link
Contributor

@Iru89 Iru89 commented Mar 25, 2026

Description

Pure structural refactor of botonic-plugin-flow-builder: splits, renames, and relocates files and functions to reduce coupling and improve module boundaries. No logic changes — only file organisation and import updates.


Context

The action/index.tsx file was doing too much: it defined FlowBuilderContext, the getContext factory, and the filterContents helper alongside the React component. This forced all action modules (fallback.ts, knowledge-bases.ts, payload.ts, etc.) to import shared types from index.tsx, creating unnecessary coupling to the entry-point file.

Similarly, structured-output/flow-builder-content.ts was buried inside action/ai-agent/, making it hard to discover and reuse.


Approach taken / Explain the design

Files moved / renamed

Before After
action/ai-agent/index.ts action/ai-agent-from-user-input.ts
action/ai-agent/structured-output/flow-builder-content.ts structured-output/flow-builder-content.ts

New file: action/context.ts

Extracted from action/index.tsx. Contains the FlowBuilderContext interface and the getFlowBuilderActionContext factory (formerly getContext):

export interface FlowBuilderContext { ... } export function getFlowBuilderActionContext(request, contentID?): FlowBuilderContext { ... }

All action modules now import FlowBuilderContext from ./context instead of from ./index.

filterContents moved to filters/index.ts

The standalone filterContents function was extracted from action/index.tsx and added to filters/index.ts, next to ContentFilterExecutor where it logically belongs.

Rename: getContentsByAiAgentgetContentsByAiAgentFromUserInput

The function was renamed to make its specific scope explicit (it only handles the user-input path, not all AI agent invocations).

Import updates

All affected files were updated to point to the new locations:

  • action/fallback.ts → imports FlowBuilderContext from ./context
  • action/first-interaction.ts → imports from ./context and ./ai-agent-from-user-input
  • action/knowledge-bases.ts → imports FlowBuilderContext from ./context
  • action/payload.ts → imports FlowBuilderContext from ./context
  • action/index.tsx → imports filterContents from ../filters, getFlowBuilderActionContext from ./context, and getContentsByAiAgentFromUserInput from ./ai-agent-from-user-input
  • content-fields/flow-ai-agent.tsx → imports FlowBuilderContentSchema from ../structured-output/flow-builder-content
  • types.ts → imports FlowBuilderContentMessage from ./structured-output/flow-builder-content

To document / Usage example

No public API changes. This is an internal refactor only.


Testing

The pull request...

  • doesn't need tests because it is a pure file reorganisation with no logic changes (all existing tests continue to pass)
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 participant