@aaronshaf/ger 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -331,7 +331,7 @@ export const reviewCommand = (changeId: string, options: ReviewOptions = {}) =>
|
|
|
331
331
|
|
|
332
332
|
if (availableStrategies.length === 0) {
|
|
333
333
|
return yield* Effect.fail(
|
|
334
|
-
new Error('No AI tools available. Please install claude, gemini, or
|
|
334
|
+
new Error('No AI tools available. Please install claude, gemini, or opencode CLI.'),
|
|
335
335
|
)
|
|
336
336
|
}
|
|
337
337
|
|
package/src/cli/index.ts
CHANGED
|
@@ -368,15 +368,12 @@ program
|
|
|
368
368
|
.option('-y, --yes', 'Skip confirmation prompts when posting comments')
|
|
369
369
|
.option('--debug', 'Show debug output including AI responses')
|
|
370
370
|
.option('--prompt <file>', 'Path to custom review prompt file (e.g., ~/prompts/review.md)')
|
|
371
|
-
.option(
|
|
372
|
-
'--provider <provider>',
|
|
373
|
-
'Preferred AI provider (claude-sdk, claude, gemini, codex, opencode)',
|
|
374
|
-
)
|
|
371
|
+
.option('--provider <provider>', 'Preferred AI provider (claude-sdk, claude, gemini, opencode)')
|
|
375
372
|
.option('--system-prompt <prompt>', 'Custom system prompt for the AI')
|
|
376
373
|
.addHelpText(
|
|
377
374
|
'after',
|
|
378
375
|
`
|
|
379
|
-
This command uses AI (Claude SDK, claude CLI, gemini CLI,
|
|
376
|
+
This command uses AI (Claude SDK, claude CLI, gemini CLI, or opencode CLI) to review a Gerrit change.
|
|
380
377
|
It performs a two-stage review process:
|
|
381
378
|
|
|
382
379
|
1. Generates inline comments for specific code issues
|
|
@@ -387,7 +384,7 @@ Use --comment to post the review to Gerrit (with confirmation prompts).
|
|
|
387
384
|
Use --comment --yes to post without confirmation.
|
|
388
385
|
|
|
389
386
|
Requirements:
|
|
390
|
-
- One of these AI tools must be available: Claude SDK (ANTHROPIC_API_KEY), claude CLI, gemini CLI,
|
|
387
|
+
- One of these AI tools must be available: Claude SDK (ANTHROPIC_API_KEY), claude CLI, gemini CLI, or opencode CLI
|
|
391
388
|
- Gerrit credentials must be configured (run 'ger setup' first)
|
|
392
389
|
|
|
393
390
|
Examples:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context, Data, Effect, Layer } from 'effect'
|
|
2
|
-
import { Console } from 'effect'
|
|
3
2
|
import { exec } from 'node:child_process'
|
|
4
3
|
import { promisify } from 'node:util'
|
|
5
4
|
|
|
@@ -198,34 +197,6 @@ export const openCodeCliStrategy: ReviewStrategy = {
|
|
|
198
197
|
}),
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
export const codexCliStrategy: ReviewStrategy = {
|
|
202
|
-
name: 'Codex CLI',
|
|
203
|
-
isAvailable: () =>
|
|
204
|
-
Effect.gen(function* () {
|
|
205
|
-
const result = yield* Effect.tryPromise({
|
|
206
|
-
try: () => execAsync('which codex'),
|
|
207
|
-
catch: () => null,
|
|
208
|
-
}).pipe(Effect.orElseSucceed(() => null))
|
|
209
|
-
|
|
210
|
-
return Boolean(result && result.stdout.trim())
|
|
211
|
-
}),
|
|
212
|
-
executeReview: (prompt, options = {}) =>
|
|
213
|
-
Effect.gen(function* () {
|
|
214
|
-
const command = `codex exec "${prompt.replace(/"/g, '\\"')}"`
|
|
215
|
-
|
|
216
|
-
const result = yield* Effect.tryPromise({
|
|
217
|
-
try: () => execAsync(command, { cwd: options.cwd }),
|
|
218
|
-
catch: (error) =>
|
|
219
|
-
new ReviewStrategyError({
|
|
220
|
-
message: `Codex CLI failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
221
|
-
cause: error,
|
|
222
|
-
}),
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
return result.stdout.trim()
|
|
226
|
-
}),
|
|
227
|
-
}
|
|
228
|
-
|
|
229
200
|
// Review service using strategy pattern
|
|
230
201
|
export class ReviewStrategyService extends Context.Tag('ReviewStrategyService')<
|
|
231
202
|
ReviewStrategyService,
|
|
@@ -247,12 +218,7 @@ export const ReviewStrategyServiceLive = Layer.succeed(
|
|
|
247
218
|
ReviewStrategyService.of({
|
|
248
219
|
getAvailableStrategies: () =>
|
|
249
220
|
Effect.gen(function* () {
|
|
250
|
-
const strategies = [
|
|
251
|
-
claudeCliStrategy,
|
|
252
|
-
geminiCliStrategy,
|
|
253
|
-
openCodeCliStrategy,
|
|
254
|
-
codexCliStrategy,
|
|
255
|
-
]
|
|
221
|
+
const strategies = [claudeCliStrategy, geminiCliStrategy, openCodeCliStrategy]
|
|
256
222
|
const available: ReviewStrategy[] = []
|
|
257
223
|
|
|
258
224
|
for (const strategy of strategies) {
|
|
@@ -267,12 +233,7 @@ export const ReviewStrategyServiceLive = Layer.succeed(
|
|
|
267
233
|
|
|
268
234
|
selectStrategy: (preferredName?: string) =>
|
|
269
235
|
Effect.gen(function* () {
|
|
270
|
-
const strategies = [
|
|
271
|
-
claudeCliStrategy,
|
|
272
|
-
geminiCliStrategy,
|
|
273
|
-
openCodeCliStrategy,
|
|
274
|
-
codexCliStrategy,
|
|
275
|
-
]
|
|
236
|
+
const strategies = [claudeCliStrategy, geminiCliStrategy, openCodeCliStrategy]
|
|
276
237
|
const available: ReviewStrategy[] = []
|
|
277
238
|
|
|
278
239
|
for (const strategy of strategies) {
|
|
@@ -285,7 +246,7 @@ export const ReviewStrategyServiceLive = Layer.succeed(
|
|
|
285
246
|
if (available.length === 0) {
|
|
286
247
|
return yield* Effect.fail(
|
|
287
248
|
new ReviewStrategyError({
|
|
288
|
-
message: 'No AI tools available. Please install claude, gemini, or
|
|
249
|
+
message: 'No AI tools available. Please install claude, gemini, or opencode CLI.',
|
|
289
250
|
}),
|
|
290
251
|
)
|
|
291
252
|
}
|