Skip to content
2 changes: 1 addition & 1 deletion packages/build/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const commandsSchema = z.array(
command: z.string(),
title: z.string(),
category: z.string().optional(),
icon: z.string().optional(),
icon: z.union([z.string(), z.object({ light: z.string(), dark: z.string() })]).optional(),
}),
)

Expand Down
29 changes: 29 additions & 0 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,32 @@ import { languagesSchema } from "./vscode.js"
*/
export const DEFAULT_WRITE_DELAY_MS = 1000

export const commitMessageGitContextSchema = z.object({
diffContextLines: z.number().int().min(0).max(20).optional(),
includeDiffStats: z.boolean().optional(),
includeCurrentBranch: z.boolean().optional(),
includeRecentCommits: z.boolean().optional(),
recentCommitCount: z.number().int().min(1).max(20).optional(),
includeRecentCommitBodies: z.boolean().optional(),
includeRecentCommitStats: z.boolean().optional(),
includeRecentCommitDiffs: z.boolean().optional(),
recentCommitDiffCount: z.number().int().min(1).max(5).optional(),
})

export type CommitMessageGitContextSettings = z.infer<typeof commitMessageGitContextSchema>

export const defaultCommitMessageGitContextSettings: Required<CommitMessageGitContextSettings> = {
diffContextLines: 3,
includeDiffStats: true,
includeCurrentBranch: true,
includeRecentCommits: true,
recentCommitCount: 5,
includeRecentCommitBodies: false,
includeRecentCommitStats: false,
includeRecentCommitDiffs: false,
recentCommitDiffCount: 1,
}

/**
* Terminal output preview size options for persisted command output.
*
Expand Down Expand Up @@ -232,6 +258,9 @@ export const globalSettingsSchema = z.object({
* Tools in this list will be excluded from prompt generation and rejected at execution time.
*/
disabledTools: z.array(toolNamesSchema).optional(),

commitMessageApiConfigId: z.string().optional(),
commitMessageGitContext: commitMessageGitContextSchema.optional(),
})

export type GlobalSettings = z.infer<typeof globalSettingsSchema>
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export enum TelemetryEventName {
TELEMETRY_SETTINGS_CHANGED = "Telemetry Settings Changed",
MODEL_CACHE_EMPTY_RESPONSE = "Model Cache Empty Response",
READ_FILE_LEGACY_FORMAT_USED = "Read File Legacy Format Used",

COMMIT_MSG_GENERATED = "Commit Message Generated",
}

/**
Expand Down Expand Up @@ -206,6 +208,7 @@ export const rooCodeTelemetryEventSchema = z.discriminatedUnion("type", [
TelemetryEventName.MODE_SETTINGS_CHANGED,
TelemetryEventName.CUSTOM_MODE_CREATED,
TelemetryEventName.READ_FILE_LEGACY_FORMAT_USED,
TelemetryEventName.COMMIT_MSG_GENERATED,
]),
properties: telemetryPropertiesSchema,
}),
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ export type ExtensionState = Pick<
| "customModePrompts"
| "customSupportPrompts"
| "enhancementApiConfigId"
| "commitMessageApiConfigId"
| "commitMessageGitContext"
| "customCondensingPrompt"
| "codebaseIndexConfig"
| "codebaseIndexModels"
Expand Down
6 changes: 6 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,8 @@ export class ClineProvider
customModePrompts,
customSupportPrompts,
enhancementApiConfigId,
commitMessageApiConfigId,
commitMessageGitContext,
autoApprovalEnabled,
customModes,
experiments,
Expand Down Expand Up @@ -2209,6 +2211,8 @@ export class ClineProvider
customModePrompts: customModePrompts ?? {},
customSupportPrompts: customSupportPrompts ?? {},
enhancementApiConfigId,
commitMessageApiConfigId,
commitMessageGitContext,
autoApprovalEnabled: autoApprovalEnabled ?? false,
customModes,
experiments: experiments ?? experimentDefault,
Expand Down Expand Up @@ -2415,6 +2419,8 @@ export class ClineProvider
customModePrompts: stateValues.customModePrompts ?? {},
customSupportPrompts: stateValues.customSupportPrompts ?? {},
enhancementApiConfigId: stateValues.enhancementApiConfigId,
commitMessageApiConfigId: stateValues.commitMessageApiConfigId,
commitMessageGitContext: stateValues.commitMessageGitContext,
experiments: stateValues.experiments ?? experimentDefault,
autoApprovalEnabled: stateValues.autoApprovalEnabled ?? false,
customModes,
Expand Down
9 changes: 9 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
import { initializeI18n } from "./i18n"
import { initializeModelCacheRefresh } from "./api/providers/fetchers/modelCache"
import { initZooCodeAuth } from "./services/zoo-code-auth"
import { registerCommitMessageProvider } from "./services/commit-message"

/**
* Built using https://github.com/microsoft/vscode-webview-ui-toolkit
Expand Down Expand Up @@ -256,6 +257,14 @@ export async function activate(context: vscode.ExtensionContext) {

registerCommands({ context, outputChannel, provider })

try {
registerCommitMessageProvider(context, outputChannel)
} catch (error) {
outputChannel.appendLine(
`Failed to register commit message provider: ${error instanceof Error ? error.message : String(error)}`,
)
}

/**
* We use the text document content provider API to show the left side for diff
* view by creating a virtual document for the original content. This makes it
Expand Down
54 changes: 54 additions & 0 deletions src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,59 @@
"connected": "Zoo Code: Successfully connected! You can now use Zoo Code as your AI provider.",
"disconnected": "Zoo Code: Disconnected successfully."
}
},
"commitMessage": {
"activated": "Zoo Code commit message generator activated",
"gitNotFound": "⚠️ Git repository not found or git not available",
"gitInitError": "⚠️ Git initialization error: {{error}}",
"generating": "Zoo: Generating commit message...",
"noChanges": "Zoo: No changes found to analyze",
"generated": "Zoo: Commit message generated!",
"generationFailed": "Zoo: Failed to generate commit message: {{errorMessage}}",
"contextWarnings": "Zoo: Git context warning: {{warnings}}",
"generatingFromUnstaged": "Zoo: Generating message using unstaged changes",
"confirmUnstaged": "No staged changes found. Generate a commit message from {{count}} unstaged/untracked changes instead?",
"confirmUnstagedAction": "Generate from unstaged changes",
"useUnstagedConfirm": "No staged changes were found. Generate a commit message from unstaged changes instead?",
"activationFailed": "Zoo: Failed to activate message generator: {{error}}",
"providerRegistered": "Zoo: Commit message provider registered",
"initializing": "Initializing...",
"discoveringFiles": "Discovering files...",
"foundChanges": "Found {{count}} changes",
"gettingContext": "Getting git context...",
"errors": {
"connectionFailed": "Failed to connect to Zoo Code extension",
"timeout": "Request timed out after 30 seconds",
"invalidResponse": "Invalid response format received from extension",
"missingMessage": "No commit message received from extension",
"noChanges": "No changes found to commit",
"noProject": "No project available",
"noWorkspacePath": "Could not determine workspace path for Git repository",
"workspaceNotFound": "Could not determine workspace path for Git repository",
"processingError": "Error processing commit message generation: {{error}}"
},
"error": {
"title": "Error",
"workspacePathNotFound": "Could not determine workspace path for Git repository",
"generationFailed": "Failed to generate commit message: {{error}}",
"processingFailed": "Error processing commit message generation: {{error}}",
"unknown": "Unknown error"
},
"dialogs": {
"info": "AI Commit Message",
"error": "Error",
"success": "Success",
"title": "AI Commit Message"
},
"progress": {
"title": "Generating Commit Message",
"analyzing": "Analyzing changes...",
"connecting": "Connecting to Zoo Code...",
"generating": "Generating commit message..."
},
"ui": {
"generateButton": "Generate Commit Message",
"generateButtonTooltip": "Generates commit message using AI to analyze your code changes"
}
}
}
22 changes: 22 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@
"command": "zoo-code.toggleAutoApprove",
"title": "%command.toggleAutoApprove.title%",
"category": "%configuration.title%"
},
{
"command": "zoo-code.generateCommitMessage",
"title": "%command.generateCommitMessage.title%",
"icon": {
"light": "assets/icons/panel_light.png",
"dark": "assets/icons/panel_dark.png"
}
}
],
"menus": {
Expand Down Expand Up @@ -207,6 +215,20 @@
"group": "1_actions@3"
}
],
"scm/input": [
{
"command": "zoo-code.generateCommitMessage",
"when": "scmProvider == git",
"group": "navigation"
}
],
Comment thread
Mirrowel marked this conversation as resolved.
"scm/title": [
{
"command": "zoo-code.generateCommitMessage",
"when": "scmProvider == git",
"group": "navigation"
}
],
"view/title": [
{
"command": "zoo-code.plusButtonClicked",
Expand Down
1 change: 1 addition & 0 deletions src/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"command.terminal.explainCommand.title": "Explain This Command",
"command.acceptInput.title": "Accept Input/Suggestion",
"command.toggleAutoApprove.title": "Toggle Auto-Approve",
"command.generateCommitMessage.title": "Generate Commit Message with Zoo",
"configuration.title": "Zoo Code",
"commands.allowedCommands.description": "Commands that can be auto-executed when 'Always approve execute operations' is enabled",
"commands.deniedCommands.description": "Command prefixes that will be automatically denied without asking for approval. In case of conflicts with allowed commands, the longest prefix match takes precedence. Add * to deny all commands.",
Expand Down
Loading
Loading