├── .rspec ├── CHANGELOG.md ├── lib ├── commitgpt │ ├── version.rb │ ├── cli.rb │ ├── string.rb │ └── commit_ai.rb └── commitgpt.rb ├── bin └── aicm ├── .gitignore ├── Rakefile ├── Gemfile ├── .rubocop.yml ├── spec ├── spec_helper.rb └── commitgpt_spec.rb ├── .github └── workflows │ └── main.yml ├── LICENSE ├── LICENSE.txt ├── commitgpt.gemspec ├── Gemfile.lock ├── README.md └── CODE_OF_CONDUCT.md /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | --require spec_helper 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [Unreleased] 2 | 3 | ## [0.1.0] - 2023-02-14 4 | 5 | - Initial release 6 | -------------------------------------------------------------------------------- /lib/commitgpt/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module CommitGpt 4 | VERSION = "0.1.2" 5 | end 6 | -------------------------------------------------------------------------------- /bin/aicm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require "commitgpt/cli" 5 | CommitGpt::CLI.start 6 | -------------------------------------------------------------------------------- /lib/commitgpt.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "commitgpt/version" 4 | require_relative "commitgpt/commit_ai" 5 | 6 | module CommitGpt 7 | class Error < StandardError; end 8 | end 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /coverage/ 5 | /doc/ 6 | /pkg/ 7 | /spec/reports/ 8 | /tmp/ 9 | 10 | # rspec failure tracking 11 | .rspec_status 12 | .idea/** 13 | .DS_Store 14 | commitgpt-*.gem 15 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "bundler/gem_tasks" 4 | require "rspec/core/rake_task" 5 | 6 | RSpec::Core::RakeTask.new(:spec) 7 | 8 | require "rubocop/rake_task" 9 | 10 | RuboCop::RakeTask.new 11 | 12 | task default: %i[spec rubocop] 13 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | # Specify your gem's dependencies in commitgpt.gemspec 6 | gemspec 7 | 8 | gem "httparty" 9 | 10 | gem "rake", "~> 13.0" 11 | 12 | gem "rspec", "~> 3.0" 13 | 14 | gem "rubocop", "~> 1.21" 15 | 16 | gem "thor" 17 | -------------------------------------------------------------------------------- /lib/commitgpt/cli.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "thor" 4 | require "commitgpt/commit_ai" 5 | 6 | module CommitGpt 7 | # CommitGpt CLI 8 | class CLI < Thor 9 | default_task :aicm 10 | 11 | desc "aicm", "AI commits for you!" 12 | def aicm 13 | CommitGpt::CommitAi.new.aicm 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/commitgpt/string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Open String to add color 4 | class String 5 | def red 6 | "\e[31m#{self}\e[0m" 7 | end 8 | 9 | def green 10 | "\e[32m#{self}\e[0m" 11 | end 12 | 13 | def gray 14 | "\e[90m#{self}\e[0m" 15 | end 16 | 17 | def magenta 18 | "\e[35m#{self}\e[0m" 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | TargetRubyVersion: 2.6 3 | 4 | Style/StringLiterals: 5 | Enabled: true 6 | EnforcedStyle: double_quotes 7 | 8 | Style/StringLiteralsInInterpolation: 9 | Enabled: true 10 | EnforcedStyle: double_quotes 11 | 12 | Layout/LineLength: 13 | Max: 160 14 | 15 | MethodLength: 16 | Max: 20 17 | 18 | Metrics/BlockLength: 19 | Max: 100 -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "commitgpt" 4 | 5 | RSpec.configure do |config| 6 | # Enable flags like --only-failures and --next-failure 7 | config.example_status_persistence_file_path = ".rspec_status" 8 | 9 | # Disable RSpec exposing methods globally on `Module` and `main` 10 | config.disable_monkey_patching! 11 | 12 | config.expect_with :rspec do |c| 13 | c.syntax = :expect 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Ruby 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | pull_request: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | name: Ruby ${{ matrix.ruby }} 14 | strategy: 15 | matrix: 16 | ruby: 17 | - '3.0.4' 18 | 19 | steps: 20 | - uses: actions/checkout@v2 21 | - name: Set up Ruby 22 | uses: ruby/setup-ruby@v1 23 | with: 24 | ruby-version: ${{ matrix.ruby }} 25 | bundler-cache: true 26 | - name: Run the default task 27 | run: bundle exec rake 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 ZPVIP 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Peng Zhang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /spec/commitgpt_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "spec_helper" 4 | require "commitgpt/commit_ai" 5 | 6 | RSpec.describe CommitGpt do 7 | let(:commit_ai) { CommitGpt::CommitAi.new } 8 | 9 | it "has a version number" do 10 | expect(CommitGpt::VERSION).not_to be nil 11 | end 12 | 13 | describe "aicm" do 14 | it "gets commit text from OpenAI API" do 15 | allow(HTTParty).to receive(:post).and_return( 16 | { "id" => "cmpl-7joXJpCMcd0620evfesv8BGCXXX99", 17 | "object" => "text_completion", 18 | "created" => 1_676_409_742, 19 | "model" => "text-davinci-003", 20 | "choices" => [ 21 | { "text" => "Add AiCommit module to generate AI-generated commit messages.", 22 | "index" => 0, 23 | "logprobs" => nil, 24 | "finish_reason" => "stop" } 25 | ], 26 | "usage" => { "prompt_tokens" => 2856, "completion_tokens" => 13, "total_tokens" => 2869 } } 27 | ) 28 | expect(commit_ai.send(:message)).to eq("Add AiCommit module to generate AI-generated commit messages.") 29 | end 30 | end 31 | 32 | it "gets no commit text from OpenAI API" do 33 | allow(HTTParty).to receive(:post).and_return( 34 | { 35 | "error" => 36 | { 37 | "message" => "The server had an error while processing your request. Sorry about that!", 38 | "type" => "server_error", 39 | "param" => nil, 40 | "code" => nil 41 | } 42 | } 43 | ) 44 | expect(commit_ai.send(:message)).to eq(nil) 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /commitgpt.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "lib/commitgpt/version" 4 | 5 | Gem::Specification.new do |spec| 6 | spec.name = "commitgpt" 7 | spec.version = CommitGpt::VERSION 8 | spec.authors = ["Peng Zhang"] 9 | spec.email = ["zpregister@gmail.com"] 10 | 11 | spec.summary = "A CLI AI that writes git commit messages for you." 12 | spec.description = "A CLI that writes your git commit messages for you with AI. Never write a commit message again." 13 | spec.homepage = "https://github.com/ZPVIP/commitgpt" 14 | spec.license = "MIT" 15 | spec.required_ruby_version = ">= 2.6.0" 16 | spec.metadata["homepage_uri"] = spec.homepage 17 | spec.metadata["source_code_uri"] = spec.homepage 18 | spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md" 19 | 20 | # Specify which files should be added to the gem when it is released. 21 | # The `git ls-files -z` loads the files in the RubyGem that have been added into git. 22 | spec.files = Dir.chdir(File.expand_path(__dir__)) do 23 | `git ls-files -z`.split("\x0").reject do |f| 24 | (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}) 25 | end 26 | end 27 | spec.bindir = "bin" 28 | spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) } 29 | spec.require_paths = ["lib"] 30 | 31 | # Uncomment to register a new dependency of your gem 32 | spec.add_dependency "httparty", "~> 0.18" 33 | spec.add_dependency "thor", "~> 1.2" 34 | 35 | # For more information and examples about making a new gem, checkout our 36 | # guide at: https://bundler.io/guides/creating_gem.html 37 | end 38 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | commitgpt (0.1.2) 5 | httparty (~> 0.18) 6 | thor (~> 1.2) 7 | 8 | GEM 9 | remote: https://rubygems.org/ 10 | specs: 11 | ast (2.4.2) 12 | diff-lcs (1.5.0) 13 | httparty (0.21.0) 14 | mini_mime (>= 1.0.0) 15 | multi_xml (>= 0.5.2) 16 | mini_mime (1.1.2) 17 | multi_xml (0.6.0) 18 | parallel (1.22.1) 19 | parser (3.1.2.0) 20 | ast (~> 2.4.1) 21 | rainbow (3.1.1) 22 | rake (13.0.6) 23 | regexp_parser (2.6.1) 24 | rexml (3.2.5) 25 | rspec (3.12.0) 26 | rspec-core (~> 3.12.0) 27 | rspec-expectations (~> 3.12.0) 28 | rspec-mocks (~> 3.12.0) 29 | rspec-core (3.12.0) 30 | rspec-support (~> 3.12.0) 31 | rspec-expectations (3.12.0) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.12.0) 34 | rspec-mocks (3.12.0) 35 | diff-lcs (>= 1.2.0, < 2.0) 36 | rspec-support (~> 3.12.0) 37 | rspec-support (3.12.0) 38 | rubocop (1.29.1) 39 | parallel (~> 1.10) 40 | parser (>= 3.1.0.0) 41 | rainbow (>= 2.2.2, < 4.0) 42 | regexp_parser (>= 1.8, < 3.0) 43 | rexml (>= 3.2.5, < 4.0) 44 | rubocop-ast (>= 1.17.0, < 2.0) 45 | ruby-progressbar (~> 1.7) 46 | unicode-display_width (>= 1.4.0, < 3.0) 47 | rubocop-ast (1.17.0) 48 | parser (>= 3.1.1.0) 49 | ruby-progressbar (1.11.0) 50 | thor (1.2.1) 51 | unicode-display_width (1.8.0) 52 | 53 | PLATFORMS 54 | arm64-darwin-21 55 | x86_64-darwin-22 56 | 57 | DEPENDENCIES 58 | commitgpt! 59 | httparty 60 | rake (~> 13.0) 61 | rspec (~> 3.0) 62 | rubocop (~> 1.21) 63 | thor 64 | 65 | BUNDLED WITH 66 | 2.4.4 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Commit GPT

4 |
5 |

A CLI that writes your git commit messages for you with AI. Never write a commit message again.

6 |
7 | 8 | --- 9 | 10 | ## Installation 11 | ```bash 12 | $ gem install commitgpt 13 | ``` 14 | 15 | ## Usage 16 | ### API key 17 | Grab your [OpenAI key](https://openai.com/api/) and add it as an env variable. 18 | ```bash 19 | $ export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx 20 | ``` 21 | It's recommended to add the first line to your `.zshrc` or `.bashrc` so it persists instead of having to define it in each terminal session. 22 | 23 | ### aicm 24 | `aicm` is an abbreviation for `AI commits`, after `git add .` add your file to stage, then use `aicm` to commit with an AI generated commit message. 25 | ```bash 26 | $ cd /path/to/your/repo 27 | $ git add . 28 | $ aicm 29 | 30 | ▲ Welcome to AI Commits! 31 | ▲ Generating your AI commit message... 32 | 33 | ▲ Commit message: git commit -am "Update README.md with contribution instructions and OpenAI API key instructions." 34 | 35 | ▲ Do you want to commit this message? [y/n] 36 | [main c082637] Update README.md with contribution instructions and OpenAI API key instructions. 37 | 4 files changed, 24 insertions(+), 19 deletions(-) 38 | ``` 39 | 40 | ### Update 41 | The latest version of the gem is `0.1.2`. To update, run the following commands: 42 | ```bash 43 | $ gem update commitgpt 44 | $ gem cleanup commitgpt 45 | $ gem info commitgpt 46 | ``` 47 | 48 | ## Special Thanks 49 | I used ChatGPT to convert `AICommits` from TypeScript to Ruby. Special thanks to [https://github.com/Nutlope/aicommits](https://github.com/Nutlope/aicommits) 50 | 51 | ## How it works 52 | This CLI tool runs a git diff command to grab all the latest changes, sends this to OpenAI's GPT-3, then returns the AI generated commit message. I also want to note that it does cost money since GPT-3 generations aren't free. However, OpenAI gives folks $18 of free credits and commit message generations are cheap so it should be free for a long time. 53 | 54 | ## Limitations 55 | Only supports git diffs of up to 200 lines of code for now 56 | The generated commit message can't be edited yet, but you can choose `n` and copy the commit command and edit it manually. 57 | 58 | ## Contributing 59 | 60 | Bug reports and pull requests are welcome on GitHub at https://github.com/ZPVIP/commitgpt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ZPVIP/commitgpt/blob/main/CODE_OF_CONDUCT.md). 61 | 62 | ## License 63 | 64 | The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). 65 | 66 | ## Code of Conduct 67 | 68 | Everyone interacting in the CommitGpt project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ZPVIP/commitgpt/blob/master/CODE_OF_CONDUCT.md). 69 | -------------------------------------------------------------------------------- /lib/commitgpt/commit_ai.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "httparty" 4 | require "json" 5 | require "io/console" 6 | require_relative "string" 7 | 8 | # CommitGpt based on GPT-3 9 | module CommitGpt 10 | # Commit AI roboter based on GPT-3 11 | class CommitAi 12 | OPENAI_API_KEY = ENV.fetch("OPENAI_API_KEY", nil) 13 | def aicm 14 | exit(1) unless welcome 15 | diff = git_diff || exit(1) 16 | ai_commit_message = message(diff) || exit(1) 17 | puts `git commit -m "#{ai_commit_message}" && echo && echo && git log -1 && echo` if confirmed 18 | end 19 | 20 | private 21 | 22 | def confirmed 23 | puts "▲ Do you want to commit this message? [y/n]".magenta 24 | 25 | use_commit_message = nil 26 | use_commit_message = $stdin.getch.downcase until use_commit_message =~ /\A[yn]\z/i 27 | 28 | puts "\n▲ Commit message has not been commited.\n".red if use_commit_message == "n" 29 | 30 | use_commit_message == "y" 31 | end 32 | 33 | def message(diff = nil) 34 | prompt = "I want you to act like a git commit message writer. I will input a git diff and your job is to convert it into a useful " \ 35 | "commit message. Do not preface the commit with anything, use the present tense, return a complete sentence, " \ 36 | "and do not repeat yourself: #{diff}" 37 | 38 | puts "▲ Generating your AI commit message...\n".gray 39 | ai_commit_message = generate_commit(prompt) 40 | return nil if ai_commit_message.nil? 41 | 42 | puts "#{"▲ Commit message: ".green}git commit -am \"#{ai_commit_message}\"\n\n" 43 | ai_commit_message 44 | end 45 | 46 | def git_diff 47 | diff = `git diff --cached . ":(exclude)Gemfile.lock" ":(exclude)package-lock.json" ":(exclude)yarn.lock" ":(exclude)pnpm-lock.yaml"`.chomp 48 | 49 | if diff.empty? 50 | puts "▲ No staged changes found. Make sure there are changes and run `git add .`".red 51 | return nil 52 | end 53 | 54 | # Accounting for GPT-3's input req of 4k tokens (approx 8k chars) 55 | if diff.length > 8000 56 | puts "▲ The diff is too large to write a commit message.".red 57 | return nil 58 | end 59 | 60 | diff 61 | end 62 | 63 | def welcome 64 | puts "\n▲ Welcome to AI Commits!".green 65 | 66 | if OPENAI_API_KEY.nil? 67 | puts "▲ Please save your OpenAI API key as an env variable by doing 'export OPENAI_API_KEY=YOUR_API_KEY'".red 68 | return false 69 | end 70 | 71 | begin 72 | `git rev-parse --is-inside-work-tree` 73 | rescue StandardError 74 | puts "▲ This is not a git repository".red 75 | return false 76 | end 77 | 78 | true 79 | end 80 | 81 | def generate_commit(prompt = "") 82 | payload = { 83 | model: "text-davinci-003", prompt: prompt, temperature: 0.7, top_p: 1, 84 | frequency_penalty: 0, presence_penalty: 0, max_tokens: 200, stream: false, n: 1 85 | } 86 | 87 | begin 88 | response = HTTParty.post("https://api.openai.com/v1/completions", 89 | headers: { "Authorization" => "Bearer #{OPENAI_API_KEY}", 90 | "Content-Type" => "application/json", "User-Agent" => "Ruby/#{RUBY_VERSION}" }, 91 | body: payload.to_json) 92 | 93 | puts "#{response.inspect}\n" 94 | 95 | ai_commit = response["choices"][0]["text"] 96 | rescue StandardError 97 | puts "▲ There was an error with the OpenAI API. Please try again later.".red 98 | return nil 99 | end 100 | 101 | ai_commit.gsub(/(\r\n|\n|\r)/, "") 102 | end 103 | end 104 | end 105 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 8 | 9 | ## Our Standards 10 | 11 | Examples of behavior that contributes to a positive environment for our community include: 12 | 13 | * Demonstrating empathy and kindness toward other people 14 | * Being respectful of differing opinions, viewpoints, and experiences 15 | * Giving and gracefully accepting constructive feedback 16 | * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 17 | * Focusing on what is best not just for us as individuals, but for the overall community 18 | 19 | Examples of unacceptable behavior include: 20 | 21 | * The use of sexualized language or imagery, and sexual attention or 22 | advances of any kind 23 | * Trolling, insulting or derogatory comments, and personal or political attacks 24 | * Public or private harassment 25 | * Publishing others' private information, such as a physical or email 26 | address, without their explicit permission 27 | * Other conduct which could reasonably be considered inappropriate in a 28 | professional setting 29 | 30 | ## Enforcement Responsibilities 31 | 32 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 33 | 34 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 35 | 36 | ## Scope 37 | 38 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 39 | 40 | ## Enforcement 41 | 42 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at p.zhang@iot-venture.com. All complaints will be reviewed and investigated promptly and fairly. 43 | 44 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 45 | 46 | ## Enforcement Guidelines 47 | 48 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 49 | 50 | ### 1. Correction 51 | 52 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 53 | 54 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 55 | 56 | ### 2. Warning 57 | 58 | **Community Impact**: A violation through a single incident or series of actions. 59 | 60 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 61 | 62 | ### 3. Temporary Ban 63 | 64 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 65 | 66 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 67 | 68 | ### 4. Permanent Ban 69 | 70 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 71 | 72 | **Consequence**: A permanent ban from any sort of public interaction within the community. 73 | 74 | ## Attribution 75 | 76 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 77 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 78 | 79 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 80 | 81 | [homepage]: https://www.contributor-covenant.org 82 | 83 | For answers to common questions about this code of conduct, see the FAQ at 84 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 85 | --------------------------------------------------------------------------------