(options?: GitCommitOptions)
| 9 | * Delegates to the commit-agent, passing appPath via instruction. |
| 10 | */ |
| 11 | export async function commit(options?: GitCommitOptions): Promise<GitCommitResult> { |
| 12 | try { |
| 13 | if (!options?.appPath) { |
| 14 | throw new Error('commit() requires options.appPath'); |
| 15 | } |
| 16 | |
| 17 | const appPath = path.resolve(options.appPath); |
| 18 | const agent = createCommitAgent(); |
| 19 | |
| 20 | const instruction = formatGitCommitInstruction({ |
| 21 | appPath, |
| 22 | iteration: options.iteration, |
| 23 | }); |
| 24 | |
| 25 | await agent.run(instruction); |
| 26 | |
| 27 | logger.printSuccessLog('Commit completed!'); |
| 28 | return { |
| 29 | success: true, |
| 30 | message: 'Commit workflow completed', |
| 31 | }; |
| 32 | } catch (error) { |
| 33 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 34 | logger.printErrorLog(`Commit failed: ${errorMessage}`); |
| 35 | return { |
| 36 | success: false, |
| 37 | message: errorMessage, |
| 38 | }; |
| 39 | } |
| 40 | } |
no test coverage detected