From a700534f93409943bb8218af6054051027f8d4b4 Mon Sep 17 00:00:00 2001
From: Anderson Bosa
Date: Sun, 12 May 2024 13:53:09 -0300
Subject: [PATCH] 2.5.1 (#4)
* chore rename main plugin file
* chor: remove tracking usage
* feat: create plugin template
chore: init awesome plugins document to list users plugins
* chore: UPDATE LICENSE TO PUBLIC DOMAIN
* feat: add aliases for zsh reloading and config editing
* fix: version update to 2.5.0
* style: refactor version manager options and functions
* chore: allow empty commit for version push
* fix: remove duplicated content from changelog
* release(2.5.0)
* feat: enhance changelog script to categorize changes based on semantic keys
* update changelog.md dates
* feat: add changelog generation script
This commit introduces a changelog generation script written in JavaScript. The script leverages the Google Gemini API to automatically generate release overview summaries. Additionally, it ensures that only semantic commit messages are included in the changelog.
* docs: update docs links and add security issue reporting
This commit updates documentation links and adds security issue reporting instructions to the README.md file.
- Updated the contribution guidelines link in the README.md file to point to the correct file location.
- Added instructions for reporting security issues to the README.md file.
- Updated the index.md file to reflect the updated links.
- Removed trailing whitespace from index.md.
* feat: added customization to changelog creation process
* fix: reorder version_manager options
* feat: bump version to 2.5.1
* release(2.5.1)
* feat: enhance changelog to categorize changes based on semantic keys
---
CHANGELOG.md | 33 ++++
docs/CONTRIBUTING.md => CONTRIBUTING.md | 0
LICENSE.md | 142 +++++++++++++---
README.md | 30 +---
docs/CHANGELOG.md | 32 ----
docs/USAGE_TRACKING_POLICY.md | 64 --------
docs/awesome_plugins.sh | 2 +
docs/index.md | 9 +-
moshell.sh/core/flags.sh | 7 -
moshell.sh/core/index.sh | 1 -
moshell.sh/core/tracking.sh | 119 --------------
moshell.sh/custom/andersonbosa/aliases.sh | 3 +
moshell.sh/moshell.sh | 2 -
moshell.sh/plugins/.template/LICENSE.md | 121 ++++++++++++++
moshell.sh/plugins/.template/README.md | 34 ++++
moshell.sh/plugins/.template/_index.sh | 16 ++
moshell.sh/plugins/.template/plugin.sh | 4 +
moshell.sh/plugins/howtos/LICENSE.md | 121 ++++++++++++++
moshell.sh/plugins/howtos/_index.sh | 10 ++
.../plugins/howtos/{all.sh => plugin.sh} | 0
moshell.sh/plugins/secrets/LICENSE.md | 121 ++++++++++++++
moshell.sh/tools/changelog.js | 151 ++++++++++++++++++
moshell.sh/tools/changelog.sh | 18 +--
moshell.sh/tools/version_manager.sh | 18 ++-
moshell.sh/version | 2 +-
25 files changed, 766 insertions(+), 294 deletions(-)
create mode 100755 CHANGELOG.md
rename docs/CONTRIBUTING.md => CONTRIBUTING.md (100%)
delete mode 100755 docs/CHANGELOG.md
delete mode 100755 docs/USAGE_TRACKING_POLICY.md
create mode 100644 docs/awesome_plugins.sh
delete mode 100755 moshell.sh/core/tracking.sh
create mode 100755 moshell.sh/plugins/.template/LICENSE.md
create mode 100644 moshell.sh/plugins/.template/README.md
create mode 100755 moshell.sh/plugins/.template/_index.sh
create mode 100755 moshell.sh/plugins/.template/plugin.sh
create mode 100755 moshell.sh/plugins/howtos/LICENSE.md
rename moshell.sh/plugins/howtos/{all.sh => plugin.sh} (100%)
create mode 100755 moshell.sh/plugins/secrets/LICENSE.md
create mode 100755 moshell.sh/tools/changelog.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100755
index 0000000..756942b
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,33 @@
+## 2024-05-12 - release(2.5.1)
+
+> - [Commit 995212e](https://github.com/andersonbosa/moshell.sh/commit/995212e)
+
+This release introduces new features and enhancements to Moshell.sh. The version manager options have been reordered, and a new changelog generation script has been added. The script categorizes changes based on semantic keys, providing a more organized and consistent changelog. Additionally, documentation links have been updated, and a process for reporting security issues has been established.
+
+- feat: bump version to 2.5.1
+- fix: reorder version_manager options
+- feat: added customization to changelog creation process
+- docs: update docs links and add security issue reporting
+- feat: add changelog generation script
+- feat: enhance changelog script to categorize changes based on semantic keys
+
+## 2023-08-18 - release(2.3.2)
+
+> [Commit d656095](https://github.com/andersonbosa/moshell.sh/commit/d656095)
+
+- feat: add automated push to version_manager.sh tool
+
+## 2023-08-17 - release(2.0.0)
+- feat(plugins): add conditional loading and enhance logging
+- feat(scripts): improve Docker container usage and add usage help
+- feat(flags): add command to update moshell.sh environment variables
+- feat(ci): add CI configuration and syntax checking
+- feat: improve logging and CLI interface
+- chore? update README.md
+- feat: implement version management script
+- feat: add installation and uninstallation scripts for Moshell.SH
+- feat: add Dockerfile and scripts for Moshell.SH
+- chore: update patch version
+- chore: refactor initialization and paths in moshell.sh
+- chore: refactor initialization and paths in moshell.sh
+- fix: add VI as default editor
diff --git a/docs/CONTRIBUTING.md b/CONTRIBUTING.md
similarity index 100%
rename from docs/CONTRIBUTING.md
rename to CONTRIBUTING.md
diff --git a/LICENSE.md b/LICENSE.md
index da85313..1625c17 100755
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,21 +1,121 @@
-MIT License
-
-Copyright (c) 2023-2023 | Anderson Bosa and contributors (https://github.com/andersonbosa/moshell.sh/contributors)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
\ No newline at end of file
diff --git a/README.md b/README.md
index 8534647..4970413 100755
--- a/README.md
+++ b/README.md
@@ -11,14 +11,14 @@
-
+
-
+
-
+
@@ -101,28 +101,12 @@ Available commands:
### Contribution
-Your contributions and suggestions are hearty ♥ welcome. [See here the contribution guidelines.](docs/CONTRIBUTING.md)
-Please, report bugs via [issues page](https://github.com/andersonbosa/moshell.sh/issues).
+Your contributions and suggestions are hearty ♥ welcome. [See here the contribution guidelines.](CONTRIBUTING.md)
----
-
-### License
-
-This work is licensed under [MIT License.](/LICENSE.md)
+Please, report bugs or security issues via [issues page](https://github.com/andersonbosa/moshell.sh/issues).
---
-### Usage Tracking Notice
-
-> By default, usage tracking is disabled. If you want to help us you can see in [this section](https://github.com/andersonbosa/moshell.sh/blob/main/docs/USAGE_TRACKING_POLICY.md#your-options) how easy is to help us.
-
-We value your privacy and want to ensure you are informed about our usage tracking
-practices. When you use our CLI, we generate a unique hashed identifier based on
-certain **non-sensitive system information** using the SHA-256 algorithm. This identifier
-helps us understand how often our CLI is being used and the general patterns of usage.
-**No personal, sensitive, or identifiable data is collected**.
-
-> If you want a better understanding, we encourage you to audit our Tracking service:
-> https://github.com/andersonbosa/moshell.sh/blob/main/moshell.sh/core/tracking.sh
+### License
-You can find more details about our approach to usage tracking in our [USAGE_TRACKING_POLICY](docs/USAGE_TRACKING_POLICY.md).
+This work is licensed under [Public Domain License](LICENSE.md).
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
deleted file mode 100755
index 6158f88..0000000
--- a/docs/CHANGELOG.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## release(2.3.2) - 2023-08-18
-
-> [Commit d656095](https://github.com/andersonbosa/moshell.sh/commit/d656095)
-
-- feat: add automated push to version_manager.sh tool
-
-## release(2.3.2) - 2023-08-18
-
-> - [Commit d656095](https://github.com/andersonbosa/moshell.sh/commit/d656095)
-
-- feat: add automated push to version_manager.sh tool
-
-## release(2.3.2) - 2023-08-18
-
-> - [Commit d656095](https://github.com/andersonbosa/moshell.sh/commit/d656095)
-
-- feat: add automated push to version_manager.sh tool
-
-## release(2.0.0) - 2023-08-17
-- feat(plugins): add conditional loading and enhance logging
-- feat(scripts): improve Docker container usage and add usage help
-- feat(flags): add command to update moshell.sh environment variables
-- feat(ci): add CI configuration and syntax checking
-- feat: improve logging and CLI interface
-- chore? update README.md
-- feat: implement version management script
-- feat: add installation and uninstallation scripts for Moshell.SH
-- feat: add Dockerfile and scripts for Moshell.SH
-- chore: update patch version
-- chore: refactor initialization and paths in moshell.sh
-- chore: refactor initialization and paths in moshell.sh
-- fix: add VI as default editor
diff --git a/docs/USAGE_TRACKING_POLICY.md b/docs/USAGE_TRACKING_POLICY.md
deleted file mode 100755
index cd69650..0000000
--- a/docs/USAGE_TRACKING_POLICY.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# Usage Tracking Notice
-
-Dear Users,
-
-We value your privacy and want to ensure you have a clear understanding of how we handle data in our application. We are introducing a simple usage tracking initiative to better understand how our application is being used. Please take a moment to review the information below.
-
-
-## Purpose of Data Collection:
-
-The collected data will help us understand how often our application is being used and the general patterns of usage. This information will aid us in making improvements and enhancements to the application based on user behavior.
-
-#### Your Options:
-
-- Opt-In: By continuing to use the application, you are agreeing to participate in our usage tracking initiative. We appreciate your support in helping us improve the application.
-- Opt-In: If you want to help us and participate, you can easily opt in of usage tracking. Simply update the flag `_MOSHELL_FLAG_ENABLE_TRACKING_SERVICE` to value 1 and your usage data will be collected. But if you want to participate without informing the data generated for hash id (see [What Data We Collect](#what-data-we-collect)), you can only disable this functionality with the flag`_MOSHELL_FLAG_ENABLE_TRACKING_FINGERPRINT` value 0.
-
-Available flags:
- - `_MOSHELL_FLAG_ENABLE_TRACKING_SERVICE` - 0/1 - Disable/enables tracking service
- - `_MOSHELL_FLAG_ENABLE_TRACKING_FINGERPRINT` - 0/1 - Disable/enables the use of non-sensitive information when generating Hash to the user ID
-
-How update flags using the Moshell.sh CLI?
-```bash
-# enable usage tracking
-mo flags _MOSHELL_FLAG_ENABLE_TRACKING_SERVICE 1
-
-# disable fingerprint collection (user distinction hash)
-mo flags _MOSHELL_FLAG_ENABLE_TRACKING_FINGERPRINT 0
-```
-
-
-## What Data We Collect:
-
-We will collect basic usage data each time the application is initialized. As part of our usage tracking, we generate a unique identifier (ID) for each instance of the App when is initialized. This ID is generated by hashing certain **non-sensitive** system information using the **SHA-256** algorithm. The collected data consists of this hashed ID, so we do not know the system details.
-> See more about Hash Functions in: [data security section](#data-security)
-
-## Data Collected:
-
-The following non-sensitive system information is used to generate the hashed ID:
-
-- Hostname
-- CPU Information
-- Total RAM
-- OS Version
-- Kernel Version
-- Username
-
-## Data Security:
-
-The generated hashed ID is a **one-way hash and cannot be reversed to reveal the original system information**. No personal, sensitive, or identifiable data is collected. The hashed ID ensures that your privacy is maintained while allowing us to gain insights into overall application usage.
-
-## Data Privacy:
-
-We take data privacy seriously. The collected data will be stored securely and will only be used for the stated purposes. No personal or sensitive information will be collected, and the data will be processed in accordance with our privacy policy.
-
-Thank you for your continued support and for being part of our community. If you have any questions or concerns about our usage tracking initiative, please don't hesitate to reach out to us at this [contact][linkedin].
-
-
-
Best regards,
Anderson Bosa
-
-
----
-
-[application]: https://github.com/andersonbosa/moshell.sh
-[linkedin]: https://www.linkedin.com/in/andersonbosa/
diff --git a/docs/awesome_plugins.sh b/docs/awesome_plugins.sh
new file mode 100644
index 0000000..5d05f17
--- /dev/null
+++ b/docs/awesome_plugins.sh
@@ -0,0 +1,2 @@
+# Awesome Moshell.sh Plugins
+
diff --git a/docs/index.md b/docs/index.md
index 3b19b7e..84f84a3 100755
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,14 +1,9 @@
# Documentation
-
-
## Useful links
-- [Usage Tracking Policy][USAGE_TRACKING_POLICY]
- [Contributing][CONTRIBUTING]
- [Changelog][CHANGELOG]
-
-[USAGE_TRACKING_POLICY]: docs/USAGE_TRACKING_POLICY.md
-[CONTRIBUTING]: docs/CONTRIBUTING.md
-[CHANGELOG]: docs/CHANGELOG.md
\ No newline at end of file
+[CONTRIBUTING]: ../CONTRIBUTING.md
+[CHANGELOG]: ../CHANGELOG.md
\ No newline at end of file
diff --git a/moshell.sh/core/flags.sh b/moshell.sh/core/flags.sh
index f9f4ab9..3d6a3ab 100755
--- a/moshell.sh/core/flags.sh
+++ b/moshell.sh/core/flags.sh
@@ -22,13 +22,6 @@ export _MOSHELL_FLAG_EDITOR=vim # default=vim # Modifies which editor
export _MOSHELL_FLAG_ENABLE_LOAD_PLUGINS=1 # default=1 # Enable plugins
export _MOSHELL_FLAG_ENABLE_LOAD_CUSTOMS=1 # default=1 # Enable customizations
-##
-# Enable anonymous tracking usage
-# - Futher details on: https://github.com/andersonbosa/moshell.sh/blob/main/docs/USAGE_TRACKING_POLICY.md
-##
-export _MOSHELL_FLAG_ENABLE_TRACKING_SERVICE=0 # default=0
-export _MOSHELL_FLAG_ENABLE_TRACKING_FINGERPRINT=1 # default=1
-
###############################################################################
# Keep this import at the end of "flags.sh"
export _MOSHELL_DIR_CORE_FLAGS_OVERRIDE="${_MOSHELL_DIR_CORE_FLAGS}.override"
diff --git a/moshell.sh/core/index.sh b/moshell.sh/core/index.sh
index 0ec95e2..d86b535 100755
--- a/moshell.sh/core/index.sh
+++ b/moshell.sh/core/index.sh
@@ -5,7 +5,6 @@ _moshell::core::index() {
# NOTE: The order matters
source "$_MOSHELL_DIR_CORE/flags.sh"
source "$_MOSHELL_DIR_CORE/logger.sh"
-source "$_MOSHELL_DIR_CORE/tracking.sh"
source "$_MOSHELL_DIR_CORE/banner.sh"
source "$_MOSHELL_DIR_CORE/cli.sh"
diff --git a/moshell.sh/core/tracking.sh b/moshell.sh/core/tracking.sh
deleted file mode 100755
index 5a4a27a..0000000
--- a/moshell.sh/core/tracking.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-export _MOSHELL_DIR_CORE_TRACKING="${BASH_SOURCE:-$0}"
-
-# TODO: leave explicit how data is used in privacy policy
-# Function to generate a user fingerprint
-function _moshell::generate_user_fingerprint() {
- local fingerprint=""
-
- if [[ "$_MOSHELL_FLAG_ENABLE_TRACKING_FINGERPRINT" == 0 ]]; then
- echo $fingerprint
- return 0
- fi
-
- # Get hostname
- local hostname=$(hostname)
- fingerprint+="hostname:${hostname},"
-
- # Get CPU information
- local cpu_info=$(lscpu | grep 'Model name' | sed 's/Model name://' | tr -d '[:space:]')
- fingerprint+="cpu:${cpu_info},"
-
- # Get total RAM
- local total_ram=$(free -h | awk '/^Mem:/{print $2}')
- fingerprint+="ram:${total_ram},"
-
- # Get OS version
- local os_version=$(lsb_release -ds | tr -d '"')
- fingerprint+="os:${os_version},"
-
- # Get kernel version
- local kernel_version=$(uname -r)
- fingerprint+="kernel:${kernel_version},"
-
- # Get username
- local username=$(whoami)
- fingerprint+="username:${username},"
-
- # Generate hash of the fingerprint
- local hashed_fingerprint=$(echo -n "$fingerprint" | sha256sum | awk '{print $1}')
-
- echo "$hashed_fingerprint"
-}
-
-function _moshell:tracking_service::build_event() {
- local token="$1"
- local event_key="$2"
- local distinct_id="$3"
-
- local software_name="moshell.sh"
- local software_version="$(mo version)"
-
- local payload=$(
- cat </dev/null
- last_return_code=$?
-
- if [[ $last_return_code -eq 200 ]]; then
- logtype=success
- else
- logtype=error
- fi
-
- _moshell::log $logtype "[_moshell:tracking_service::track_events] [user: $EVENT_USER_FINGERPRINT] [event: $EVENT_USAGE_KEY]"
-
-}
-
-function _moshell:tracking_service() {
- if [[ "$_MOSHELL_FLAG_ENABLE_TRACKING_SERVICE" == "1" ]]; then
- _moshell:tracking_service::track_events &>/dev/null
- fi
-}
diff --git a/moshell.sh/custom/andersonbosa/aliases.sh b/moshell.sh/custom/andersonbosa/aliases.sh
index 0f43ebd..cb5431b 100755
--- a/moshell.sh/custom/andersonbosa/aliases.sh
+++ b/moshell.sh/custom/andersonbosa/aliases.sh
@@ -34,6 +34,9 @@ alias tbu="nc termbin.com 9999"
alias tat="tmux attach"
alias hosts="sudo $EDITOR /etc/hosts"
+alias zshreload="source ~/.zshrc"
+alias zshconfig="$EDITOR ~/.zshrc && zshreload"
+
alias copy="clipcopy"
alias tf=terraform
alias kubectl="minikube kubectl -- "
diff --git a/moshell.sh/moshell.sh b/moshell.sh/moshell.sh
index 5ab7d61..db27f9c 100755
--- a/moshell.sh/moshell.sh
+++ b/moshell.sh/moshell.sh
@@ -22,8 +22,6 @@ _moshell::log success "moshell.sh version '$(mo version)' initialized!"
[[ "$_MOSHELL_FLAG_VERBOSE" == 1 ]] && _moshell::banner::print
-(_moshell:tracking_service &) # DISCLAIMER: Run tracking without trap user CLI
-
###############################################################################
# TODO: I tried to perform import in a dynamic way but it was not possible ...
#
diff --git a/moshell.sh/plugins/.template/LICENSE.md b/moshell.sh/plugins/.template/LICENSE.md
new file mode 100755
index 0000000..1625c17
--- /dev/null
+++ b/moshell.sh/plugins/.template/LICENSE.md
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
\ No newline at end of file
diff --git a/moshell.sh/plugins/.template/README.md b/moshell.sh/plugins/.template/README.md
new file mode 100644
index 0000000..f741246
--- /dev/null
+++ b/moshell.sh/plugins/.template/README.md
@@ -0,0 +1,34 @@
+ # Plugin Template
+
+This is a template for creating plugins for your Shellscript-based framework. This template provides a basic structure and guidelines to help you get started with developing new plugins quickly.
+
+## Structure
+
+The template follows a standard structure for plugins, with the following files and directories:
+
+- `_index.sh`: A script that provides to Moshell.sh how to boot the plugin.
+- `plugin.sh`: The main plugin script that contains the core functionality of the plugin.
+
+You can add more files like `.env` and other things, just keep in mind that you always need to work with the **absolute path** when importing your.
+
+## Getting Started
+
+To use this template, follow these steps:
+
+1. Clone or download the template repository.
+2. Rename the directory to match the name of your plugin.
+3. Code your plugin's functionality in `plugin.sh`.
+4. Customize the `README.md` file to describe your plugin, its features, and how to use it.
+5. Create a Issue on the [GitHub repository](https://github.com/andersonbosa/moshell.sh) **to share your plugin** with the Moshell.sh community.
+
+## Plugin Development Guidelines
+
+TBD TO BE DEFINED
+
+By following guidelines, you can create high-quality, maintainable plugins that integrate seamlessly with your framework.
+
+## Contributing
+
+If you have any suggestions, bug reports, or feature requests, please feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/andersonbosa/moshell.sh).
+
+Happy coding!
diff --git a/moshell.sh/plugins/.template/_index.sh b/moshell.sh/plugins/.template/_index.sh
new file mode 100755
index 0000000..fbc00e8
--- /dev/null
+++ b/moshell.sh/plugins/.template/_index.sh
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+#
+# This file will be executed by Moshell.sh to import your plugin.
+# For example, you can create conditions in "load_plugin" to define
+# whether the plugin will be loaded or not.
+#
+
+ABSOLUTE_PATH_TO_THIS_FILE="${BASH_SOURCE:-$0}"
+ABSOLUTE_DIR_PATH_TO_THIS_FILE=$(dirname $ABSOLUTE_PATH_TO_THIS_FILE)
+
+load_plugin() {
+ source $ABSOLUTE_DIR_PATH_TO_THIS_FILE/plugin.sh
+}
+
+load_plugin
+
diff --git a/moshell.sh/plugins/.template/plugin.sh b/moshell.sh/plugins/.template/plugin.sh
new file mode 100755
index 0000000..d88684b
--- /dev/null
+++ b/moshell.sh/plugins/.template/plugin.sh
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+
+# This file will be imported by Moshell.sh to boot your plugin.
+# Put your plugin code here.
\ No newline at end of file
diff --git a/moshell.sh/plugins/howtos/LICENSE.md b/moshell.sh/plugins/howtos/LICENSE.md
new file mode 100755
index 0000000..1625c17
--- /dev/null
+++ b/moshell.sh/plugins/howtos/LICENSE.md
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
\ No newline at end of file
diff --git a/moshell.sh/plugins/howtos/_index.sh b/moshell.sh/plugins/howtos/_index.sh
index a659138..5991607 100755
--- a/moshell.sh/plugins/howtos/_index.sh
+++ b/moshell.sh/plugins/howtos/_index.sh
@@ -1 +1,11 @@
# TODO: Plugin that teaches/shows how to do something
+
+ABSOLUTE_PATH_TO_THIS_FILE="${BASH_SOURCE:-$0}"
+ABSOLUTE_DIR_PATH_TO_THIS_FILE=$(dirname $ABSOLUTE_PATH_TO_THIS_FILE)
+
+load_plugin() {
+ source $ABSOLUTE_DIR_PATH_TO_THIS_FILE/plugin.sh
+}
+
+load_plugin
+
diff --git a/moshell.sh/plugins/howtos/all.sh b/moshell.sh/plugins/howtos/plugin.sh
similarity index 100%
rename from moshell.sh/plugins/howtos/all.sh
rename to moshell.sh/plugins/howtos/plugin.sh
diff --git a/moshell.sh/plugins/secrets/LICENSE.md b/moshell.sh/plugins/secrets/LICENSE.md
new file mode 100755
index 0000000..1625c17
--- /dev/null
+++ b/moshell.sh/plugins/secrets/LICENSE.md
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
\ No newline at end of file
diff --git a/moshell.sh/tools/changelog.js b/moshell.sh/tools/changelog.js
new file mode 100755
index 0000000..ffe1265
--- /dev/null
+++ b/moshell.sh/tools/changelog.js
@@ -0,0 +1,151 @@
+#!/usr/bin/env node
+
+const { execSync } = require('node:child_process')
+const { dirname, join } = require('node:path')
+const fs = require('node:fs')
+const os = require('node:os')
+const https = require('node:https')
+
+
+// Defines the absolute path of the script file and the script directory
+const ABSOLUTE_SCRIPT_FILE_PATH = process.argv[1]
+const ABSOLUTE_SCRIPT_DIR_PATH = dirname(ABSOLUTE_SCRIPT_FILE_PATH)
+
+const { GOOGLE_GEMINI_API_KEY } = process.env
+
+function getLastNthReleaseCommit (nth) {
+ if (!nth) throw new Error('nth is required')
+ const RELEASE_VERSION_GREP_REGEX = 'release([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+)'
+ const awkQueryFirstItemOnTheRow = `NR==${nth}`
+ const gitLogCommand = `git log --pretty=format:%H --grep="${RELEASE_VERSION_GREP_REGEX}" | awk ${awkQueryFirstItemOnTheRow}`
+ const lastReleaseCommit = execSync(gitLogCommand).toString().trim()
+ return lastReleaseCommit
+}
+
+// Adds header levels based on the Commit key
+function parseCommitFormat (commitHash, _author, date, message) {
+ const linkToRepository = "https://github.com/andersonbosa/moshell.sh"
+ const isRelease = message.startsWith("release")
+ if (isRelease) {
+ return `## ${date} - ${message} ${os.EOL}${os.EOL}> - [Commit ${commitHash}](${linkToRepository}/commit/${commitHash})${os.EOL}TBD`
+ } else {
+ return `- ${message}`
+ }
+}
+
+function isSemanticCommit (commitMessage) {
+ const semanticCommitKeys = ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore', 'perf', 'build', 'ci', 'revert', 'release']
+ const verifyCommit = key => commitMessage?.toLowerCase().startsWith(key.toLowerCase())
+ return semanticCommitKeys.some(verifyCommit)
+}
+
+// Analyzes an input line and converts it into a changelog format
+function parseLineToChangelog (acc, line) {
+ const [commitHash, author, date, message] = line.split(",")
+
+ if (!isSemanticCommit(message)) return acc
+
+ const changelogEntry = parseCommitFormat(commitHash, author, date, message)
+
+ return [...acc, changelogEntry]
+}
+
+
+async function generateReleaseOverviewWithGoogleGemini (releaseContent, aditionalInfo = '') {
+ if (!GOOGLE_GEMINI_API_KEY) {
+ return ''
+ }
+
+ const prompt = `
+Your mission is to write paragraph about this release using the context from the commits provided below. Write a brief resume about what happened. Don't add header to text neither don't use lists. Do not quote the current version, just focus on what was done. Do not talk about the version being updated.
+
+\`\`\`
+${releaseContent}
+\`\`\`
+
+${aditionalInfo}`
+
+ const options = {
+ hostname: 'generativelanguage.googleapis.com',
+ path: '/v1beta/models/gemini-pro:generateContent?key=' + GOOGLE_GEMINI_API_KEY,
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }
+
+ const response = await new Promise((resolve, reject) => {
+ const req = https.request(options, (response) => {
+ let data = ''
+ response.on('data', (chunk) => {
+ data += chunk
+ })
+ response.on('end', () => {
+ try {
+ const responseData = JSON.parse(data)
+ const contentOutput = responseData.candidates[0].content.parts[0].text
+ resolve(contentOutput)
+ } catch (error) {
+ reject(new Error('Error parsing response: ' + error.message))
+ }
+ })
+ })
+
+ req.on('error', (e) => {
+ reject(new Error('Error generating content: ' + e.message))
+ })
+
+ const requestBody = JSON.stringify({ contents: [{ parts: [{ text: prompt }] }] })
+
+ req.write(requestBody)
+ req.end()
+ })
+
+ return response
+}
+
+function getCommitsFromCurrentVersion (fromCommit, sinceCommit) {
+ if (!fromCommit || !sinceCommit) throw new Error('fromCommit and sinceCommit are required')
+
+ const gitLogCommand = `git log --pretty=format:%h,%an,%as,%s "${fromCommit}...${sinceCommit}"`
+ const commitsFromTheCurrentVersion = execSync(gitLogCommand).toString().split(os.EOL)
+ return commitsFromTheCurrentVersion
+}
+
+// Main function to generate Changelog
+async function generateChangelog (
+ currentChangelog,
+ outputPath = 'CHANGELOG.md'
+) {
+ const changelogFilePath = join(`${ABSOLUTE_SCRIPT_DIR_PATH}`, '../..', currentChangelog)
+ console.log(changelogFilePath)
+ const changelogFileContentBackup = fs.existsSync(changelogFilePath)
+ ? fs.readFileSync(changelogFilePath, 'utf-8')
+ : ''
+
+ // Limpa/inicializa o arquivo
+ // fs.writeFileSync(changelogFilePath, '')
+
+ const fromCommit = getLastNthReleaseCommit(1)
+ const sinceCommit = getLastNthReleaseCommit(2)
+ const commitsFromTheCurrentVersion = getCommitsFromCurrentVersion(fromCommit, sinceCommit)
+
+ const changelogLines = commitsFromTheCurrentVersion.reduce(parseLineToChangelog, [])
+
+ const changelogContentFromNewVersion = changelogLines.join(os.EOL)
+
+ // const geminiResponse = false
+ const geminiResponse = await generateReleaseOverviewWithGoogleGemini(changelogContentFromNewVersion)
+
+ const changelogContent = changelogContentFromNewVersion
+ .replace('TBD', geminiResponse ? `${os.EOL}${geminiResponse}${os.EOL}` : '')
+ .concat(os.EOL)
+ .concat(os.EOL)
+ .concat(`${changelogFileContentBackup}`)
+
+ fs.writeFileSync(outputPath, changelogContent)
+ // fs.appendFileSync(changelogFilePath, `\n${changelogFileContentBackup}`)
+}
+
+const outputPath = process.argv[2]
+generateChangelog(outputPath)
diff --git a/moshell.sh/tools/changelog.sh b/moshell.sh/tools/changelog.sh
index 0320ffa..b3129c8 100755
--- a/moshell.sh/tools/changelog.sh
+++ b/moshell.sh/tools/changelog.sh
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
#
# Author: @andersonbosa
-# Description:
-# XXX
+# Description: This script generates a changelog based on Git commit history.
+# It identifies the last release commit, parses the commit messages, and
+# categorizes them into different sections based on semantic keys. The resulting
+# changelog is formatted and saved to a specified file location.
#
ABSOLUTE_SCRIPT_FILE_PATH="${BASH_SOURCE:-$0}"
@@ -16,8 +18,8 @@ function __moshell:tools::changelog::get_last_release_commit() {
release_version_regex=$default_regex
fi
- local awk_query_2_item_on_the_row='NR==2'
- local last_release_commit=$(git log --grep="$release_version_regex" --pretty=format:"%H" | awk "$awk_query_2_item_on_the_row")
+ local awk_query_first_item_on_the_row='NR==1'
+ local last_release_commit=$(git log --grep=$release_version_regex --pretty=format:"%H" | awk "$awk_query_first_item_on_the_row")
echo "$last_release_commit"
}
@@ -64,21 +66,19 @@ function __moshell:tools::changelog::parse_line_to_changelog() {
}
function __moshell:tools::changelog::main() {
- LAST_CONSIDERATED_COMMIT=$(__moshell:tools::changelog::get_last_release_commit)
- # echo "[+] Using commit: $LAST_CONSIDERATED_COMMIT"
+ LAST_RELEASE_COMMIT=$(__moshell:tools::changelog::get_last_release_commit)
local changelog_file="$_MOSHELL_DIR_BASE_PATH/../docs/CHANGELOG.md"
local changelog_file_content_backup=""
-
if [ -f "$changelog_file" ]; then
changelog_file_content_backup=$(cat "$changelog_file")
fi
# Cleans/init the file
- >"$changelog_file"
+ echo '' >"$changelog_file"
local tmp_file=$(mktemp)
- git log --pretty=format:"%h,%an,%as,%s" "$LAST_CONSIDERATED_COMMIT..HEAD" >"$tmp_file"
+ git log --pretty=format:"%h,%an,%as,%s" "$LAST_RELEASE_COMMIT..HEAD" >"$tmp_file"
local tmp_file_reversed=$(mktemp)
awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' $tmp_file >$tmp_file_reversed
diff --git a/moshell.sh/tools/version_manager.sh b/moshell.sh/tools/version_manager.sh
index 8a36488..45126c3 100755
--- a/moshell.sh/tools/version_manager.sh
+++ b/moshell.sh/tools/version_manager.sh
@@ -57,13 +57,15 @@ function __moshell:tools::version_manager::increment_version() {
new_version="$major.$minor.$patch"
echo "$new_version" >$_MOSHELL_DIR_BASE_PATH/version
+ # Update the version in README.md badge
+ local README_PATH=$ABSOLUTE_SCRIPT_DIR_PATH/../../README.md
+ sed -i "s/version-$current_version/version-$new_version/g" $README_PATH
+
echo "[+] Version incremented to: $new_version"
}
function __moshell::tools::version_manager::push_version() {
- # NOTE: talvez no futuro use a
- git add version
- git commit -m "release($(cat $_MOSHELL_DIR_BASE_PATH/version))"
+ git commit --allow-empty -m "release($(cat $_MOSHELL_DIR_BASE_PATH/version))"
git push -u origin $(git branch --show-current)
exit 0
}
@@ -75,11 +77,11 @@ function __moshell::tools::version_manager::show_usage() {
echo "Usage: $(basename $0) [OPTIONS]"
echo
echo "Options:"
- echo " -1, --patch Increment the patch version"
- echo " -2, --minor Increment the minor version"
- echo " -3, --major Increment the major version"
- echo " -P, --push Release NEW VERSION to the git repository"
- echo " -h, --help Show this usage message"
+ echo " -1, --major Increment the major version"
+ echo " -2, --minor Increment the minor version"
+ echo " -3, --patch Increment the patch version"
+ echo " -R, --release Release NEW VERSION to the git repository"
+ echo " -h, --help Show this usage message"
exit 0
}
diff --git a/moshell.sh/version b/moshell.sh/version
index 005119b..73462a5 100755
--- a/moshell.sh/version
+++ b/moshell.sh/version
@@ -1 +1 @@
-2.4.1
+2.5.1