( task: Task, service: RepoPerTaskCheckpointService, log: (message: string) => void, provider: any, )
| 130 | } |
| 131 | |
| 132 | async function checkGitInstallation( |
| 133 | task: Task, |
| 134 | service: RepoPerTaskCheckpointService, |
| 135 | log: (message: string) => void, |
| 136 | provider: any, |
| 137 | ) { |
| 138 | try { |
| 139 | const gitInstalled = await checkGitInstalled() |
| 140 | |
| 141 | if (!gitInstalled) { |
| 142 | log("[Task#getCheckpointService] Git is not installed, disabling checkpoints") |
| 143 | task.enableCheckpoints = false |
| 144 | task.checkpointServiceInitializing = false |
| 145 | |
| 146 | // Show user-friendly notification |
| 147 | const selection = await vscode.window.showWarningMessage( |
| 148 | t("common:errors.git_not_installed"), |
| 149 | t("common:buttons.learn_more"), |
| 150 | ) |
| 151 | |
| 152 | if (selection === t("common:buttons.learn_more")) { |
| 153 | await vscode.env.openExternal(vscode.Uri.parse("https://git-scm.com/downloads")) |
| 154 | } |
| 155 | |
| 156 | return |
| 157 | } |
| 158 | |
| 159 | // Git is installed, proceed with initialization |
| 160 | service.on("initialize", () => { |
| 161 | log("[Task#getCheckpointService] service initialized") |
| 162 | task.checkpointServiceInitializing = false |
| 163 | }) |
| 164 | |
| 165 | service.on("checkpoint", ({ fromHash: from, toHash: to, suppressMessage }) => { |
| 166 | try { |
| 167 | sendCheckpointInitWarn(task) |
| 168 | // Always update the current checkpoint hash in the webview, including the suppress flag |
| 169 | provider?.postMessageToWebview({ |
| 170 | type: "currentCheckpointUpdated", |
| 171 | text: to, |
| 172 | suppressMessage: !!suppressMessage, |
| 173 | }) |
| 174 | |
| 175 | // Always create the chat message but include the suppress flag in the payload |
| 176 | // so the chatview can choose not to render it while keeping it in history. |
| 177 | task.say( |
| 178 | "checkpoint_saved", |
| 179 | to, |
| 180 | undefined, |
| 181 | undefined, |
| 182 | { from, to, suppressMessage: !!suppressMessage }, |
| 183 | undefined, |
| 184 | { isNonInteractive: true }, |
| 185 | ).catch((err) => { |
| 186 | log("[Task#getCheckpointService] caught unexpected error in say('checkpoint_saved')") |
| 187 | console.error(err) |
| 188 | }) |
| 189 | } catch (err) { |
no test coverage detected