Skip to content

Rename CliCommand abstraction to CliCommandFactory#4880

Merged
adrians5j merged 14 commits intonextfrom
copilot/rename-cli-command-to-factory
Jan 18, 2026
Merged

Rename CliCommand abstraction to CliCommandFactory#4880
adrians5j merged 14 commits intonextfrom
copilot/rename-cli-command-to-factory

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Rename CliCommand to CliCommandFactory ✅

  • 1. Rename the abstraction in packages/cli-core/src/abstractions/features/CliCommand.ts
    • Update export from CliCommand to CliCommandFactory
    • Update namespace from CliCommand to CliCommandFactory
  • 2. Update all imports across the codebase
    • Update import statements in packages/cli-core (27 files)
    • Update import statements in packages/project-aws (3 files)
    • Update import statements in packages/webiny (1 file)
    • Update import statements in extensions (1 file)
  • 3. Update all type references
    • Change CliCommand.Interface to CliCommandFactory.Interface
    • Change CliCommand.CommandDefinition to CliCommandFactory.CommandDefinition
    • Change CliCommand.createImplementation to CliCommandFactory.createImplementation
    • Update abstraction: CliCommand to abstraction: CliCommandFactory
  • 4. Update extension definitions
    • Keep extension exports as CliCommand and CliCommandDecorator (not renamed)
    • Extension imports reference the renamed CliCommandFactory abstraction
    • JSX components use <CliCommand> (not <CliCommandFactory>)
  • 5. Verify changes compile successfully
    • TypeScript compilation verified - no errors related to the refactoring

Summary

Successfully renamed the CliCommand abstraction to CliCommandFactory across the entire codebase. Extension exports remain as CliCommand for backward compatibility while internally referencing the renamed CliCommandFactory abstraction.

Changes Made:

  • 37 files modified in initial refactoring
  • 4 files adjusted to preserve extension naming
  • All command implementations in packages/cli-core and packages/project-aws updated
  • Extension system maintains CliCommand and CliCommandDecorator exports for backward compatibility
  • Abstraction layer uses CliCommandFactory to reflect factory pattern
Original prompt

go into packages/cli-core/src/abstractions/features/CliCommand.ts and rename the abs to CliCommandFactory.

this update should be reflected in all commands like for example in packages/project-aws and packages/cli-core.

The user has attached the following files from their workspace:

  • packages/project-aws/src/extensions/Webiny/BlueGreenDeployments/SetPrimaryVariantCliCommand.ts

TITLE: Rename CliCommand abstraction to CliCommandFactory

USER INTENT: Rename the abstract class CliCommand to CliCommandFactory and update all references across the codebase, particularly in packages/project-aws and packages/cli-core.

TASK DESCRIPTION:

  • Rename the abstract class in packages/cli-core/src/abstractions/features/CliCommand.ts from CliCommand to CliCommandFactory
  • Update all imports and references to this class throughout the codebase
  • Ensure all command implementations in packages/project-aws and packages/cli-core reflect this change

EXISTING:

  • The abstract class exists at packages/cli-core/src/abstractions/features/CliCommand.ts
  • Commands in packages/project-aws and packages/cli-core currently extend or reference CliCommand
  • A minor UI update was completed: replaced hardcoded 48px with CSS variable var(--h-main-content) in packages/app-website-builder/src/BaseEditor/config/Sidebar/ScrollableContainer.tsx

PENDING:

  • Rename the abstract class from CliCommand to CliCommandFactory in packages/cli-core/src/abstractions/features/CliCommand.ts
  • Update all imports of CliCommand to CliCommandFactory across the codebase
  • Update all class extensions (extends CliCommand) to extends CliCommandFactory
  • Verify changes in packages/project-aws command files
  • Verify changes in packages/cli-core command files

CODE STATE:

  • packages/cli-core/src/abstractions/features/CliCommand.ts - Needs to be renamed to export CliCommandFactory instead of CliCommand
  • packages/app-website-builder/src/BaseEditor/config/Sidebar/ScrollableContainer.tsx - Updated to use h-[calc(100vh-65px-var(--h-main-content))] instead of h-[calc(100vh-65px-48px)]
  • Multiple command files in packages/project-aws and packages/cli-core - Need to update imports and class extensions

RELEVANT CODE/DOCUMENTATION SNIPPETS:

// packages/app-website-builder/src/BaseEditor/config/Sidebar/ScrollableContainer.tsx (COMPLETED)
export const ScrollableContainer = ({ children }: any) => {
    return (
        <ScrollArea className={"h-[calc(100vh-65px-var(--h-main-content))]"}>
            <div>{children}</div>
        </ScrollArea>
    );
};

OTHER NOTES:

  • This is a refactoring task to improve code clarity by renaming the abstraction to better reflect its purpose as a factory pattern
  • The rename should be applied consistently across all command implementations
  • The previous UI task (CSS variable update) was completed successfully before this refactoring request

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

Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Copilot AI changed the title [WIP] Rename CliCommand abstraction to CliCommandFactory Rename CliCommand abstraction to CliCommandFactory Jan 16, 2026
Copilot AI requested a review from adrians5j January 16, 2026 20:29
Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

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


{/* Blue-green */}
<CliCommand src={p("Webiny/BlueGreenDeployments/SetPrimaryVariantCliCommand.js")} />
<CliCommandFactory src={p("Webiny/BlueGreenDeployments/SetPrimaryVariantCliCommand.js")} />
Copy link
Member

Choose a reason for hiding this comment

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

This React component I want to still be CliCommand. It's only the abstraction (impl) that will use CliCommandFactory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 89ceed3. The React component now uses <CliCommand> while the abstraction uses CliCommandFactory.

import { z } from "zod";

export const CliCommand = defineExtension({
export const CliCommandFactory = defineExtension({
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned, make the actual ext CliCommand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 89ceed3. The extension export is now CliCommand while internally referencing the CliCommandFactory abstraction.

Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
@adrians5j adrians5j changed the base branch from adrian/new-ref-field-2026-01-15 to next January 18, 2026 09:03
@Pavel910 Pavel910 added this to the 6.0.0 milestone Jan 18, 2026
@adrians5j adrians5j marked this pull request as ready for review January 18, 2026 11:03
@adrians5j adrians5j merged commit e67f00b into next Jan 18, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants