Skip to main content

kickjs-cli-plugin

Use when adding a kick <name> command, a kick g <name> generator, or a typegen emitter to this project or a package it ships.

ソース情報

リポジトリ
forinda/kickjs-examples-archive
ソースの最終更新活動
2026年10月16日 00:14
検出された SKILL.md の言語
英語
スター
0
フォーク
0

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
kickjs-cli-plugin
description
Use when adding a kick <name> command, a kick g <name> generator, or a typegen emitter to this project or a package it ships.
<!-- Generated by `kick g agents` for settings-api. Edits are overwritten on the next refresh; keep customisation in a SKILL.local.md alongside. --> A CLI plugin contributes commands, generators and typegen emitters to the `kick` CLI. Every built-in command ships as one, so the contract is the same one the framework uses. **Steps**: 1. Write the plugin. All four contribution kinds are optional: ```ts // kick-tool.ts import { defineCliPlugin } from '@forinda/kickjs-cli' export const toolPlugin = (options: { watch?: boolean } = {}) => defineCliPlugin({ // Stable id, unique across plugins — it names the plugin in conflict errors. name: 'my-tool', // Declarative: same shape as kick.config.ts `commands`. commands: [{ name: 'db:migrate', description: 'Apply migrations', steps: 'node ./scripts/migrate.js' }], // Programmatic: full commander API, when you need options or subcommands. register(program, ctx) { program .command('my-tool') .description('Do the thing') .option('--watch', 'Watch mode') .action(async () => { ctx.log(`running in ${ctx.projectRoot}`) // ctx.config is the loaded kick.config.ts }) }, }) ``` 2. Register it in `kick.config.ts`: ```ts import { toolPlugin } from './kick-tool' export default defineConfig({ plugins: [toolPlugin()] }) ``` 3. Check it is loaded, per contribution kind: `kick --help` lists a command, `kick g --list` lists a generator, `kick typegen` runs an emitter. A plugin that fails to load takes the whole CLI down with a conflict error, so silence here means the config never referenced it. **Which kind to use**: `commands` for a shell one-liner, `register` for options / subcommands / async work, `generators` (`defineGenerator`) for `kick g <name>` scaffolders, `typegens` for a file under `.kickjs/types/`. **Red flags**: - Confusing this with a runtime plugin: `defineCliPlugin` (from `@forinda/kickjs-cli`) extends the CLI; `definePlugin` (from `@forinda/kickjs`) hooks the running app. They share nothing. - Claiming a command name a built-in owns (`build:netlify`, `typegen`, `generate`) — duplicate declarative names are a startup conflict, and `register` has no conflict detection at all, so it silently loses. Namespace your own (`my-tool:build`). - Doing real work inside `register` — it runs at CLI startup for every command, so it must only register. Put the work in the action. - Importing heavy dependencies at module scope. `await import()` them inside the action, so an unrelated `kick dev` does not pay for them.
GitHubで見る