From 5449d5cd61c34189f36961e4712be26d996c0635 Mon Sep 17 00:00:00 2001
From: di-sukharev <dim.sukharev@gmail.com>
Date: Fri, 17 Mar 2023 14:20:39 +0800
Subject: [PATCH 1/7] 1.1.12

---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index e6ec1090..6bcf851c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "opencommit",
-  "version": "1.1.11",
+  "version": "1.1.12",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "opencommit",
-      "version": "1.1.11",
+      "version": "1.1.12",
       "license": "ISC",
       "dependencies": {
         "@clack/prompts": "^0.6.1",
diff --git a/package.json b/package.json
index 7c238aca..9a36bac6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "opencommit",
-  "version": "1.1.11",
+  "version": "1.1.12",
   "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
   "keywords": [
     "git",

From b3509e34d0784119734de1df674a9158b0f5fa6c Mon Sep 17 00:00:00 2001
From: di-sukharev <dim.sukharev@gmail.com>
Date: Fri, 17 Mar 2023 14:20:51 +0800
Subject: [PATCH 2/7] 1.1.13

---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 6bcf851c..e81992f1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "opencommit",
-  "version": "1.1.12",
+  "version": "1.1.13",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "opencommit",
-      "version": "1.1.12",
+      "version": "1.1.13",
       "license": "ISC",
       "dependencies": {
         "@clack/prompts": "^0.6.1",
diff --git a/package.json b/package.json
index 9a36bac6..d08921dd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "opencommit",
-  "version": "1.1.12",
+  "version": "1.1.13",
   "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
   "keywords": [
     "git",

From 8f0a32275eb147f595a794a76c6578645ee0b7ba Mon Sep 17 00:00:00 2001
From: di-sukharev <dim.sukharev@gmail.com>
Date: Fri, 17 Mar 2023 17:50:39 +0800
Subject: [PATCH 3/7] 1.1.14

---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index e81992f1..e40a1276 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "opencommit",
-  "version": "1.1.13",
+  "version": "1.1.14",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "opencommit",
-      "version": "1.1.13",
+      "version": "1.1.14",
       "license": "ISC",
       "dependencies": {
         "@clack/prompts": "^0.6.1",
diff --git a/package.json b/package.json
index d08921dd..c3c7813d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "opencommit",
-  "version": "1.1.13",
+  "version": "1.1.14",
   "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
   "keywords": [
     "git",

From 0f33b74942f8c0484a5a80238ae84cb30c4d9153 Mon Sep 17 00:00:00 2001
From: di-sukharev <dim.sukharev@gmail.com>
Date: Fri, 17 Mar 2023 17:51:36 +0800
Subject: [PATCH 4/7] 1.1.15

---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index e40a1276..35d5f948 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "opencommit",
-  "version": "1.1.14",
+  "version": "1.1.15",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "opencommit",
-      "version": "1.1.14",
+      "version": "1.1.15",
       "license": "ISC",
       "dependencies": {
         "@clack/prompts": "^0.6.1",
diff --git a/package.json b/package.json
index c3c7813d..17b7c375 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "opencommit",
-  "version": "1.1.14",
+  "version": "1.1.15",
   "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
   "keywords": [
     "git",

From 0092e9206133396db5db51698511f50b38f7ce1a Mon Sep 17 00:00:00 2001
From: di-sukharev <dim.sukharev@gmail.com>
Date: Fri, 17 Mar 2023 17:51:42 +0800
Subject: [PATCH 5/7] 1.1.16

---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 35d5f948..7526506c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "opencommit",
-  "version": "1.1.15",
+  "version": "1.1.16",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "opencommit",
-      "version": "1.1.15",
+      "version": "1.1.16",
       "license": "ISC",
       "dependencies": {
         "@clack/prompts": "^0.6.1",
diff --git a/package.json b/package.json
index 17b7c375..5904aad0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "opencommit",
-  "version": "1.1.15",
+  "version": "1.1.16",
   "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
   "keywords": [
     "git",

From 83c77eb5009389b4e4c9ed1e8c75effa0e3b2307 Mon Sep 17 00:00:00 2001
From: "nader.zouaoui" <nader.zouaoui@edonec.com>
Date: Fri, 17 Mar 2023 16:46:33 +0100
Subject: [PATCH 6/7] =?UTF-8?q?=E2=9C=A8=20feat(cli.ts):=20add=20checkIsLa?=
 =?UTF-8?q?testVersion=20function?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit adds a new function that checks if the current version of OpenCommit is the latest version. The function uses the getOpenCommitLatestVersion function from the api module to get the latest version of OpenCommit. If the current version is not the latest version, a warning message is printed to the console, informing the user to update to the latest version to get the latest features and bug fixes.
---
 src/api.ts                        | 19 ++++++++++++++++++-
 src/cli.ts                        |  4 +++-
 src/utils/checkIsLatestVersion.ts | 23 +++++++++++++++++++++++
 3 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 src/utils/checkIsLatestVersion.ts

diff --git a/src/api.ts b/src/api.ts
index 72dcece2..0d1b36f3 100644
--- a/src/api.ts
+++ b/src/api.ts
@@ -53,7 +53,10 @@ class OpenAi {
     } catch (error: unknown) {
       outro(`${chalk.red('✖')} ${error}`);
 
-      if (axios.isAxiosError<{ error?: { message: string } }>(error) && error.response?.status === 401) {
+      if (
+        axios.isAxiosError<{ error?: { message: string } }>(error) &&
+        error.response?.status === 401
+      ) {
         const openAiError = error.response.data.error;
 
         if (openAiError?.message) outro(openAiError.message);
@@ -67,4 +70,18 @@ class OpenAi {
   };
 }
 
+export const getOpenCommitLatestVersion = async (): Promise<
+  string | undefined
+> => {
+  try {
+    const { data } = await axios.get(
+      'https://unpkg.com/opencommit/package.json'
+    );
+    return data.version;
+  } catch (_) {
+    outro('Error while getting the latest version of opencommit');
+    return undefined;
+  }
+};
+
 export const api = new OpenAi();
diff --git a/src/cli.ts b/src/cli.ts
index 5bc56e59..c285fd55 100755
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -7,6 +7,7 @@ import { configCommand } from './commands/config';
 import { hookCommand, isHookCalled } from './commands/githook.js';
 import { prepareCommitMessageHook } from './commands/prepare-commit-msg-hook';
 import { commit } from './commands/commit';
+import { checkIsLatestVersion } from './utils/checkIsLatestVersion';
 
 const rawArgv = process.argv.slice(2);
 
@@ -19,7 +20,8 @@ cli(
     ignoreArgv: (type) => type === 'unknown-flag' || type === 'argument',
     help: { description: packageJSON.description }
   },
-  () => {
+  async () => {
+    await checkIsLatestVersion();
     if (isHookCalled) {
       prepareCommitMessageHook();
     } else {
diff --git a/src/utils/checkIsLatestVersion.ts b/src/utils/checkIsLatestVersion.ts
new file mode 100644
index 00000000..456fcfaf
--- /dev/null
+++ b/src/utils/checkIsLatestVersion.ts
@@ -0,0 +1,23 @@
+import { getOpenCommitLatestVersion } from '../api';
+import currentPackage from '../../package.json' assert { type: 'json' };
+import chalk from 'chalk';
+export const checkIsLatestVersion = async () => {
+  const latestVersion = await getOpenCommitLatestVersion();
+
+  if (latestVersion) {
+    const currentVersion = currentPackage.version;
+
+    if (currentVersion !== latestVersion) {
+      console.warn(
+        chalk.yellow(
+          `
+You are not using the latest stable version of OpenCommit!
+consider updating to the latest version to get the latest features and bug fixes.
+Current version: ${currentVersion}
+Latest version: ${latestVersion}
+        `
+        )
+      );
+    }
+  }
+};

From 5b4c0a81a3cf887099a6e0323da34f2a8a38316f Mon Sep 17 00:00:00 2001
From: Nader Zouaoui <nader.zouaoui@edonec.com>
Date: Fri, 17 Mar 2023 18:04:28 +0100
Subject: [PATCH 7/7] Update checkIsLatestVersion.ts

---
 src/utils/checkIsLatestVersion.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/utils/checkIsLatestVersion.ts b/src/utils/checkIsLatestVersion.ts
index 456fcfaf..555fc690 100644
--- a/src/utils/checkIsLatestVersion.ts
+++ b/src/utils/checkIsLatestVersion.ts
@@ -12,9 +12,10 @@ export const checkIsLatestVersion = async () => {
         chalk.yellow(
           `
 You are not using the latest stable version of OpenCommit!
-consider updating to the latest version to get the latest features and bug fixes.
+Consider updating to the latest version to get the latest features and bug fixes.
 Current version: ${currentVersion}
 Latest version: ${latestVersion}
+🎉 To update to the latest version, run: npm update opencommit
         `
         )
       );