ワンクリックで
oclif-command-guide
Reference for OCLIF command patterns, base classes, and conventions used in CLI packages
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Reference for OCLIF command patterns, base classes, and conventions used in CLI packages
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Add a new OCLIF command to a CLI package with proper base class, flags, args, and post-creation steps
Create changesets for pending changes by analyzing git diff and commit history
Audit workspace dependencies for version mismatches, unused packages, and sync issues across all packages
Fix all repository policy violations
Run Nx affected commands for the current changes
Reference for Nx task architecture, orchestration patterns, and how to add or modify build tasks
| name | oclif-command-guide |
| description | Reference for OCLIF command patterns, base classes, and conventions used in CLI packages |
| user-invocable | false |
Reference for working with OCLIF commands in this monorepo's CLI packages (cli, dill-cli, repopo, sort-tsconfig).
CommandWithConfig — For commands that load config files. Provides --config flag and config resolution.GitCommand — For git operations. Provides this.git (simple-git instance) and git-aware error handling. Extends CommandWithConfig.Always extend one of these base classes, not raw OCLIF Command.
import { Args, Flags } from "@oclif/core";
import { GitCommand } from "@tylerbu/cli-api";
export default class MyCommand extends GitCommand<typeof MyCommand> {
public static override readonly description = "What this command does";
public static override readonly flags = {
"dry-run": Flags.boolean({ description: "Preview without making changes" }),
...GitCommand.flags, // Inherit base flags
};
public static override readonly args = {
target: Args.string({ required: true, description: "Target branch" }),
};
public override async run(): Promise<void> {
const { args, flags } = this;
// this.git is available from GitCommand
// this.log(), this.warn(), this.error() for output
}
}
Commands go in src/commands/. Directory structure defines topics:
src/commands/download.ts → tbu downloadsrc/commands/git/squish.ts → tbu git squishsrc/commands/git/merge-train/preview.ts → tbu git merge-train previewAlways run these steps after changing commands:
pnpm nx run <pkg>:build:compile — Compile TypeScriptpnpm nx run <pkg>:build:manifest — Regenerate oclif.manifest.jsonpnpm nx run <pkg>:build:readme — Regenerate README command docs./packages/<pkg>/bin/dev.js snapshot:generate — Update test snapshots (if applicable)Or just run pnpm nx run <pkg>:build to execute all of these via orchestration.
./bin/dev.js <command> — runs from TypeScript source, no compile needed./bin/run.js <command> — runs from compiled esm/CLI packages declare plugins in package.json → oclif.plugins. Common ones:
@oclif/plugin-help, @oclif/plugin-autocomplete, @oclif/plugin-commands@oclif/plugin-command-snapshot — for snapshot testing@oclif/plugin-command-snapshottest/commands/__snapshots__/commands.json./bin/dev.js snapshot:generate./bin/dev.js snapshot:compare (runs during test:snapshots)