Skip to content

Commit 1b70060

Browse files
author
ityaozm@gmail.com
committed
feat(generators): Add GithubModelsCliGenerator for command execution
- Create a new class `GithubModelsCliGenerator` to generate models using GitHub CLI. - Update `composer.json` to add CLI commands for GitHub models. - Configure new CLI settings in `ai-commit.php` for better model handling.
1 parent a750bd2 commit 1b70060

File tree

4 files changed

+208
-73
lines changed

4 files changed

+208
-73
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of the guanguans/ai-commit.
7+
*
8+
* (c) guanguans <ityaozm@gmail.com>
9+
*
10+
* This source file is subject to the MIT license that is bundled.
11+
*/
12+
13+
namespace App\Generators;
14+
15+
use Symfony\Component\Process\Process;
16+
17+
final class GithubModelsCliGenerator extends Generator
18+
{
19+
public function generate(string $prompt): string
20+
{
21+
return resolve(
22+
Process::class,
23+
['command' => [$this->config['binary'], 'models', 'run', $this->config['model'], $prompt]] + $this->config['parameters']
24+
)->mustRun($this->defaultRunningCallback())->getOutput();
25+
}
26+
}

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142
"ai-commit-bito-no-verify": "@ai-commit-bito --no-verify",
143143
"ai-commit-github-copilot": "@ai-commit --generator=github_copilot_cli",
144144
"ai-commit-github-copilot-no-verify": "@ai-commit-github-copilot --no-verify",
145+
"ai-commit-github-models": "@ai-commit --generator=github_models_cli",
146+
"ai-commit-github-models-no-verify": "@ai-commit-github-models --no-verify",
145147
"ai-commit-no-verify": "@ai-commit --no-verify",
146148
"cghooks": "@php ./vendor/bin/cghooks --ansi -v",
147149
"cghooks-install": [

0 commit comments

Comments
 (0)