Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions bin/moses.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env node

import { Command } from 'commander';
import { runInit } from '../src/commands/init/index.js';
import { execute } from '../src/commands/validate/index.js';
import { runSetDiffLimit, runSetFeedbackStyle } from '../src/commands/update-config/index.js';
import { runListGitlabs } from '../src/commands/gitlab/list.js';
import { runSwitchGitlab } from '../src/commands/gitlab/switch.js';
import { InitCommand } from '../src/commands/init/index.js';
import { ValidateCommand } from '../src/commands/validate/index.js';
import {
SetDiffLimitCommand,
SetFeedbackStyleCommand,
} from '../src/commands/update-config/index.js';
import { ListGitlabsCommand } from '../src/commands/gitlab/list.js';
import { SwitchGitlabCommand } from '../src/commands/gitlab/switch.js';
import type { ValidateOptions } from '../src/types/index.js';
import packageJson from '../package.json' with { type: 'json' };

Expand All @@ -18,31 +21,40 @@ program
)
.version(packageJson.version);

program.command('init').description('Interactive initial setup').action(runInit);
program
.command('init')
.description('Interactive initial setup')
.action(() => InitCommand.run());

program
.command('validate')
.description('Validate a GitLab Merge Request with an AI tool')
.argument('<url>', 'GitLab Merge Request URL')
.option('-p, --prompt <text>', 'Additional context prompt to send with MR diff')
.action((url: string, options: ValidateOptions) => execute(url, options));
.action((url: string, options: ValidateOptions) => ValidateCommand.execute(url, options));

const config = program.command('config').description('Manage Moses configuration');

config
.command('feedback-style')
.description('Update AI feedback style on Merge Requests')
.action(runSetFeedbackStyle);
.action(() => SetFeedbackStyleCommand.run());

config
.command('diff-limit')
.description('Update maximum allowed diff changes limit')
.action(runSetDiffLimit);
.action(() => SetDiffLimitCommand.run());

const gitlab = program.command('gitlab').description('Manage GitLab instances');

gitlab.command('list').description('List all configured GitLab instances').action(runListGitlabs);
gitlab
.command('list')
.description('List all configured GitLab instances')
.action(() => ListGitlabsCommand.run());

gitlab.command('default').description('Change the default GitLab instance').action(runSwitchGitlab);
gitlab
.command('default')
.description('Change the default GitLab instance')
.action(() => SwitchGitlabCommand.run());

void program.parseAsync(process.argv);
Loading
Loading