kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 20:32:49 +02:00
parent 05bcb14b99
commit 02b53e82ca
8 changed files with 555 additions and 68 deletions

View file

@ -7,13 +7,16 @@ const vaultPaths = ref<Record<string, string>>({})
const deployCommands = ref<Record<string, string>>({})
const testCommands = ref<Record<string, string>>({})
const autoTestEnabled = ref<Record<string, boolean>>({})
const worktreesEnabled = ref<Record<string, boolean>>({})
const saving = ref<Record<string, boolean>>({})
const savingTest = ref<Record<string, boolean>>({})
const savingAutoTest = ref<Record<string, boolean>>({})
const savingWorktrees = ref<Record<string, boolean>>({})
const syncing = ref<Record<string, boolean>>({})
const saveStatus = ref<Record<string, string>>({})
const saveTestStatus = ref<Record<string, string>>({})
const saveAutoTestStatus = ref<Record<string, string>>({})
const saveWorktreesStatus = ref<Record<string, string>>({})
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
const error = ref<string | null>(null)
@ -43,6 +46,7 @@ onMounted(async () => {
deployCommands.value[p.id] = p.deploy_command ?? ''
testCommands.value[p.id] = p.test_command ?? ''
autoTestEnabled.value[p.id] = !!(p.auto_test_enabled)
worktreesEnabled.value[p.id] = !!(p.worktrees_enabled)
deployHosts.value[p.id] = p.deploy_host ?? ''
deployPaths.value[p.id] = p.deploy_path ?? ''
deployRuntimes.value[p.id] = p.deploy_runtime ?? ''
@ -116,6 +120,21 @@ async function toggleAutoTest(projectId: string) {
}
}
async function toggleWorktrees(projectId: string) {
worktreesEnabled.value[projectId] = !worktreesEnabled.value[projectId]
savingWorktrees.value[projectId] = true
saveWorktreesStatus.value[projectId] = ''
try {
await api.patchProject(projectId, { worktrees_enabled: worktreesEnabled.value[projectId] })
saveWorktreesStatus.value[projectId] = 'Saved'
} catch (e: unknown) {
worktreesEnabled.value[projectId] = !worktreesEnabled.value[projectId]
saveWorktreesStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
} finally {
savingWorktrees.value[projectId] = false
}
}
async function runSync(projectId: string) {
syncing.value[projectId] = true
syncResults.value[projectId] = null
@ -371,6 +390,23 @@ async function deleteLink(projectId: string, linkId: number) {
</span>
</div>
<div class="flex items-center gap-3 mb-3">
<label class="flex items-center gap-2 cursor-pointer select-none">
<input
type="checkbox"
:checked="worktreesEnabled[project.id]"
@change="toggleWorktrees(project.id)"
:disabled="savingWorktrees[project.id]"
class="w-4 h-4 rounded border-gray-600 bg-gray-800 accent-blue-500 cursor-pointer disabled:opacity-50"
/>
<span class="text-sm text-gray-300">Worktrees</span>
<span class="text-xs text-gray-500"> агенты запускаются в изолированных git worktrees</span>
</label>
<span v-if="saveWorktreesStatus[project.id]" class="text-xs" :class="saveWorktreesStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
{{ saveWorktreesStatus[project.id] }}
</span>
</div>
<div class="flex items-center gap-3 flex-wrap">
<button
@click="saveVaultPath(project.id)"