From c17ad255b58264e23781d4e2e1cc8d89785fc3b4 Mon Sep 17 00:00:00 2001 From: Taylor AI Date: Fri, 5 Dec 2025 10:08:25 +0500 Subject: [PATCH] Implemented autocommit --- .opencode/plugin/dev-server-hmr.ts | 49 ++++++++++++++++-------------- index.html | 2 +- package.json | 2 +- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.opencode/plugin/dev-server-hmr.ts b/.opencode/plugin/dev-server-hmr.ts index 0bfb3a4..1d6e1d6 100644 --- a/.opencode/plugin/dev-server-hmr.ts +++ b/.opencode/plugin/dev-server-hmr.ts @@ -17,17 +17,17 @@ const axios = new Axios({ }); const updateAppStatus = async (status: "Errored" | "Active" | "Pending") => { - // await axios.put( - // "/", - // JSON.stringify({ - // status, - // }), - // { - // headers: { - // "Content-Type": "application/json", - // }, - // } - // ); + await axios.put( + "/", + JSON.stringify({ + status, + }), + { + headers: { + "Content-Type": "application/json", + }, + } + ); }; export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => { @@ -39,7 +39,14 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => { path: { id: event.properties.sessionID }, }); - console.dir(session, { depth: null }); + const isAnyChange = + session.data?.summary?.files && session.data.summary.files > 0; + + if (!isAnyChange) { + await updateAppStatus("Active"); + + return; + } const result = await $`pnpm build`.catch((error) => error); @@ -83,32 +90,28 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => { const commitMessage = session.data?.title ?? `feat: release version v${newVersion}`; - await $`git config user.name "Taylor AI"`; - await $`git config user.email "ai@taylordb.io"`; - await $`git add .`; - await $`git commit -m ${commitMessage}`; - await $`git tag v${newVersion}`; - await $`git push origin main --tags`; - packageJson.version = newVersion; await fs.writeFile( "package.json", JSON.stringify(packageJson, null, 2) ); + + await $`git config user.name "Taylor AI"`; + await $`git config user.email "ai@taylordb.io"`; + await $`git add .`; + await $`git commit -m ${commitMessage}`; + await $`git tag v${newVersion}`; + await $`git push origin main --tags`; } catch (error) { console.error("Failed to push to git", error); } await updateAppStatus("Active"); - - console.log("CHANGE STATUS TO ACTIVE"); }, "chat.message": async () => { await updateAppStatus("Pending"); - - console.log("CHANGE STATUS TO PENDING"); }, }; }; diff --git a/index.html b/index.html index ec8fa89..1d24401 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - task tracker + blank
diff --git a/package.json b/package.json index 3781847..6c66003 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "blank", "private": true, - "version": "0.0.2", + "version": "0.0.3", "type": "module", "scripts": { "dev": "vite",