11import { describe , expect , it } from 'vitest' ;
22import { TestRig } from './test-rig' ;
3- import { mkdirSync , copyFileSync , readFileSync } from 'node:fs' ;
3+ import { mkdirSync , copyFileSync , readFileSync , writeFileSync } from 'node:fs' ;
44import { join } from 'node:path' ;
55import { execSync } from 'node:child_process' ;
66
@@ -13,6 +13,8 @@ interface ReviewCase {
1313
1414const datasetPath = join ( __dirname , 'data/pr-review.json' ) ;
1515const dataset : ReviewCase [ ] = JSON . parse ( readFileSync ( datasetPath , 'utf-8' ) ) ;
16+ const REVIEW_TOML_URL =
17+ 'https://raw.githubusercontent.com/gemini-cli-extensions/code-review/main/commands/code-review.toml' ;
1618
1719describe ( 'PR Review Workflow' , ( ) => {
1820 for ( const item of dataset ) {
@@ -22,14 +24,17 @@ describe('PR Review Workflow', () => {
2224 const rig = new TestRig ( `review-${ item . id } ` ) ;
2325 try {
2426 rig . setupMockMcp ( ) ;
25- mkdirSync ( join ( rig . testDir , '.gemini/commands' ) , { recursive : true } ) ;
26- copyFileSync (
27- '.github/commands/gemini-review.toml' ,
28- join ( rig . testDir , '.gemini/commands/gemini-review.toml' ) ,
29- ) ;
27+ const commandDir = join ( rig . testDir , '.gemini/commands' ) ;
28+ mkdirSync ( commandDir , { recursive : true } ) ;
29+
30+ const response = await fetch ( REVIEW_TOML_URL ) ;
31+ if ( ! response . ok )
32+ throw new Error ( `Failed to fetch TOML: ${ response . statusText } ` ) ;
33+ const tomlContent = await response . text ( ) ;
34+ writeFileSync ( join ( commandDir , 'code-review.toml' ) , tomlContent ) ;
3035
3136 const stdout = await rig . run (
32- [ '--prompt' , '/gemini -review' , '--yolo' ] ,
37+ [ '--prompt' , '/code-review' , 'pr -review', '--yolo' ] ,
3338 item . inputs ,
3439 ) ;
3540
0 commit comments