본문으로 건너뛰기
Skillpedia
일반 코딩8.1k · #12593

webiny-cli-extensions

하는 일

이 스킬은 Webiny 명령줄 도구에 새 명령을 만들 때 AI를 돕습니다. 자신의 스크립트를 프로젝트의 CLI로 실행하고 싶은 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓데이터 마이그레이션이나 콘텐츠 내보내기를 위한 맞춤 명령이 필요할 때.
  • ✓Webiny CLI 안에서 코드 생성기나 배포 도우미가 필요한 경우.
  • ✓명확한 터미널 출력을 보여 주는 상태 점검 명령을 원할 때.

스킬 링크

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/cli-extensions/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/cli-extensions/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“모든 블로그 항목을 JSON 파일로 내보내는 Webiny CLI 명령을 추가해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 이름, 설명, 타입이 지정된 매개변수, 핸들러를 가진 명령 클래스를 설명합니다. 핸들러는 터미널 도우미를 통해 메시지를 출력하며, 명령은 설정 파일에 등록됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

CLI Extensions

TL;DR

Add custom commands to the Webiny CLI using the CliCommandFactory pattern. Define a class implementing CliCommandFactory.Interface<TParams>, specify command name, description, params, and handler, then export with CliCommandFactory.createImplementation(). Register in webiny.config.tsx via <Cli.Command>.

The CliCommandFactory Pattern

// extensions/MyCustomCommand.ts
import { Ui } from "webiny/cli";
import { CliCommandFactory } from "webiny/cli/command";

export interface IMyCustomCommandParams {
  name: string;
}

class MyCustomCommandImpl implements CliCommandFactory.Interface<IMyCustomCommandParams> {
  constructor(private ui: Ui.Interface) {}

  execute(): CliCommandFactory.CommandDefinition<IMyCustomCommandParams> {
    return {
      name: "my-custom-command",
      description: "This is my custom command",
      examples: ["$0 my-custom-command test1", "$0 my-custom-command test2"],
      params: [
        {
          name: "name",
          description: "Your name",
          type: "string"
        }
      ],
      handler: async params => {
        this.ui.info("Starting my custom command...");
        this.ui.emptyLine();
        this.ui.success(`Hello, ${params.name}! This is my custom command.`);
      }
    };
  }
}

export default CliCommandFactory.createImplementation({
  implementation: MyCustomCommandImpl,
  dependencies: [Ui]
});

Register in webiny.config.tsx (YOU MUST include the .ts file extension in the src prop — omitting it will cause a build failure):

<Cli.Command src={"/extensions/MyCustomCommand.ts"} />

Run it:

yarn webiny my-custom-command "World"

Command Definition Properties

Property Type Description
name string The command name used on the CLI (e.g., "my-custom-command")
description string Help text shown when listing commands
examples string[] Usage examples ($0 is replaced with the CLI binary name)
params ParamDefinition[] Positional parameters and options
handler (params: TParams) => Promise<void> The function that executes the command

Parameter Definition

Each param in the params array:

Property Type Description
name string Parameter name (matches the key in your TParams interface)
description string Help text for this parameter
type "string" | "number" | "boolean" Parameter value type

The Ui Service

Inject Ui for formatted terminal output:

import { Ui } from "webiny/cli";
Method Description
this.ui.info("message") Print an info message (blue)
this.ui.success("message") Print a success message (green)
this.ui.warning("message") Print a warning message (yellow)
this.ui.error("message") Print an error message (red)
this.ui.emptyLine() Print a blank line for spacing

Use Cases

  • Data migrations -- Scripts to migrate or seed CMS data
  • Code generators -- Generate boilerplate extension files
  • Deployment scripts -- Custom deployment workflows
  • Data exports -- Export CMS content to files
  • Health checks -- Verify infrastructure or API status

Quick Reference

Import:          import { CliCommandFactory } from "webiny/cli/command";
Ui import:       import { Ui } from "webiny/cli";
Interface:       CliCommandFactory.Interface<TParams>
Definition:      CliCommandFactory.CommandDefinition<TParams>
Export:          CliCommandFactory.createImplementation({ implementation, dependencies })
Registe
자주 묻는 질문

명령은 어떻게 등록하나요?

설정 파일의 command 항목으로 등록합니다.

매개변수는 어떻게 정의하나요?

각 매개변수에는 이름, 설명, 타입이 있습니다.

명령은 출력을 어떻게 보여 주나요?

정보, 성공 메시지, 빈 줄을 출력하는 터미널 도우미를 통해 보여 줍니다.

상세 정보

작성자의 원본 설명

Adding custom commands to the Webiny CLI using CliCommandFactory. Use this skill when the developer wants to create a custom CLI command, add a data migration script, build a code generator, create deployment scripts, export CMS content, or add health check commands. Covers CliCommandFactory.Interface, command definition, typed parameters, the Ui service for terminal output, and registration via <Cli.Command>.

repo: webiny/webiny-js

인기도

GitHub 스타
8.1k
순위
#12593
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬