feat(coding-agent): migrated CLI from custom parser to oclif framework for improved structure
- Migrated CLI from custom argument parser to oclif framework for improved command structure and maintainability. - Reorganized CLI subcommands into individual command files under src/commands/ directory with oclif Command classes. - Added oclif configuration to package.json with bin name 'omp', commands directory, and autocomplete plugin support. - Refactored CLI entry point in src/cli.ts to use oclif's run() function with improved error handling. - Simplified extension flag parsing by directly iterating raw arguments instead of using dynamic flag definitions. - Updated CHANGELOG.md with comprehensive documentation of new oclif-based CLI commands and migration details.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Generate and optionally push a commit with changelog updates.
|
||||
*/
|
||||
import { Command, Flags } from "@oclif/core";
|
||||
import { runCommitCommand } from "../commit";
|
||||
import type { CommitCommandArgs } from "../commit/types";
|
||||
import { initTheme } from "../modes/theme/theme";
|
||||
|
||||
export default class Commit extends Command {
|
||||
static description = "Generate a commit message and update changelogs";
|
||||
|
||||
static flags = {
|
||||
push: Flags.boolean({ description: "Push after committing" }),
|
||||
"dry-run": Flags.boolean({ description: "Preview without committing" }),
|
||||
"no-changelog": Flags.boolean({ description: "Skip changelog updates" }),
|
||||
legacy: Flags.boolean({ description: "Use legacy deterministic pipeline" }),
|
||||
context: Flags.string({ char: "c", description: "Additional context for the model" }),
|
||||
model: Flags.string({ char: "m", description: "Override model selection" }),
|
||||
};
|
||||
|
||||
async run(): Promise<void> {
|
||||
const { flags } = await this.parse(Commit);
|
||||
|
||||
const cmd: CommitCommandArgs = {
|
||||
push: flags.push ?? false,
|
||||
dryRun: flags["dry-run"] ?? false,
|
||||
noChangelog: flags["no-changelog"] ?? false,
|
||||
legacy: flags.legacy,
|
||||
context: flags.context,
|
||||
model: flags.model,
|
||||
};
|
||||
|
||||
await initTheme();
|
||||
await runCommitCommand(cmd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user