一键导入
add-oclif-command
Add a new OCLIF command to a CLI package with proper base class, flags, args, and post-creation steps
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new OCLIF command to a CLI package with proper base class, flags, args, and post-creation steps
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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
Reference for OCLIF command patterns, base classes, and conventions used in CLI packages
| name | add-oclif-command |
| description | Add a new OCLIF command to a CLI package with proper base class, flags, args, and post-creation steps |
| disable-model-invocation | true |
Guided workflow to add a command to an existing CLI package.
Ask the user for:
status or git/status (slash = topic nesting)CommandWithConfig (default) or GitCommand (for git operations) — both from @tylerbu/cli-apiCreate packages/<pkg>/src/commands/<name>.ts:
import { Args, Flags } from "@oclif/core";
import { CommandWithConfig } from "@tylerbu/cli-api";
export default class CommandName extends CommandWithConfig<typeof CommandName> {
public static override readonly description = "Description here";
public static override readonly flags = {
// Add flags here
...CommandWithConfig.flags,
};
public static override readonly args = {
// Add args here
};
public override async run(): Promise<void> {
const { args, flags } = this;
// Implementation
}
}
For git commands, use GitCommand instead — it provides this.git (simple-git instance).
# Compile
pnpm nx run <pkg>:build:compile
# Test with dev binary
./packages/<pkg>/bin/dev.js <command> --help
# Regenerate manifest
pnpm nx run <pkg>:build:manifest
# Regenerate README
pnpm nx run <pkg>:build:readme
# Regenerate command snapshots
./packages/<pkg>/bin/dev.js snapshot:generate --filepath test/commands/__snapshots__/commands.json
# Verify snapshots match
./packages/<pkg>/bin/dev.js snapshot:compare --filepath test/commands/__snapshots__/commands.json
# Full build to ensure everything links
pnpm nx run <pkg>:build
# Run tests
pnpm nx run <pkg>:test
# Policy check
./packages/repopo/bin/dev.js check
this.log() for stdout, this.warn() for warnings, this.error() for fatal errors (exits)...BaseClass.flags to inherit base flags