Implemented autocommit

This commit is contained in:
Taylor AI 2025-12-05 10:08:25 +05:00
parent a45d97d173
commit c17ad255b5
3 changed files with 28 additions and 25 deletions

View File

@ -17,17 +17,17 @@ const axios = new Axios({
}); });
const updateAppStatus = async (status: "Errored" | "Active" | "Pending") => { const updateAppStatus = async (status: "Errored" | "Active" | "Pending") => {
// await axios.put( await axios.put(
// "/", "/",
// JSON.stringify({ JSON.stringify({
// status, status,
// }), }),
// { {
// headers: { headers: {
// "Content-Type": "application/json", "Content-Type": "application/json",
// }, },
// } }
// ); );
}; };
export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => { export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => {
@ -39,7 +39,14 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => {
path: { id: event.properties.sessionID }, 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); const result = await $`pnpm build`.catch((error) => error);
@ -83,32 +90,28 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => {
const commitMessage = const commitMessage =
session.data?.title ?? `feat: release version v${newVersion}`; 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; packageJson.version = newVersion;
await fs.writeFile( await fs.writeFile(
"package.json", "package.json",
JSON.stringify(packageJson, null, 2) 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) { } catch (error) {
console.error("Failed to push to git", error); console.error("Failed to push to git", error);
} }
await updateAppStatus("Active"); await updateAppStatus("Active");
console.log("CHANGE STATUS TO ACTIVE");
}, },
"chat.message": async () => { "chat.message": async () => {
await updateAppStatus("Pending"); await updateAppStatus("Pending");
console.log("CHANGE STATUS TO PENDING");
}, },
}; };
}; };

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>task tracker</title> <title>blank</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View File

@ -1,7 +1,7 @@
{ {
"name": "blank", "name": "blank",
"private": true, "private": true,
"version": "0.0.2", "version": "0.0.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",