Skip to content

Commit 1bacaa0

Browse files
committed
Automatically create a titled checkpoint using the commit message whenever changes are successfully committed
1 parent e256819 commit 1bacaa0

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎packages/vscode/src/commands/checkpoints-command/actions/create-checkpoint.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import { get_checkpoint_path } from '../utils'
88

99
export const create_checkpoint = async (
1010
workspace_provider: WorkspaceProvider,
11-
context: vscode.ExtensionContext
11+
context: vscode.ExtensionContext,
12+
title: string = 'Created by user',
13+
description?: string
1214
): Promise<boolean> => {
1315
try {
1416
const timestamp = Date.now()
@@ -27,8 +29,9 @@ export const create_checkpoint = async (
2729
await copy_workspace_to_dir(checkpoint_dir_uri, workspace_provider)
2830

2931
const new_checkpoint: Checkpoint = {
30-
title: 'Created by user',
31-
timestamp
32+
title,
33+
timestamp,
34+
description
3235
}
3336

3437
const checkpoints = await get_checkpoints(context)

‎packages/vscode/src/views/panel/backend/panel-provider.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import { Logger } from '@shared/utils/logger'
8585
import { CancelTokenSource } from 'axios'
8686
import { update_last_used_preset_or_group } from './message-handlers/update-last-used-preset-or-group'
8787
import { undo_files } from '@/commands/apply-chat-response-command/utils/file-operations'
88+
import { create_checkpoint } from '@/commands/checkpoints-command/actions'
8889
import { dictionary } from '@shared/constants/dictionary'
8990

9091
export class ViewProvider implements vscode.WebviewViewProvider {
@@ -455,6 +456,16 @@ export class ViewProvider implements vscode.WebviewViewProvider {
455456
await handle_commit_changes(this)
456457
} else if (message.command == 'ACCEPT_COMMIT_MESSAGE') {
457458
await handle_accept_commit_message(this, message.commit_message)
459+
460+
const title = 'Committed changes'
461+
const description = message.commit_message
462+
463+
await create_checkpoint(
464+
this.workspace_provider,
465+
this.context,
466+
title,
467+
description
468+
)
458469
} else if (message.command == 'CANCEL_COMMIT_MESSAGE') {
459470
await handle_cancel_commit_message(this)
460471
} else if (message.command == 'MANAGE_CONFIGURATIONS') {

0 commit comments

Comments
 (0)