Skip to content

Commit

Permalink
feat: add initial project files
Browse files Browse the repository at this point in the history
This commit adds the initial project files for the AI Commit CLI tool. The project includes a `Cargo.toml` file with the necessary dependencies, a `Makefile` for build and distribution tasks, a `README.md` file with project information, and a `res/prompt.md` file with the Conventional Commits specification.

The project also includes the following modules:
- `cmd`: Contains the command-line interface implementation.
- `common`: Contains common utility modules for error handling and logging.
- `external`: Contains modules for interacting with external tools such as Bitwarden and Git.

The `cmd` module includes the following subcommands:
- `commit`: Implements the logic for creating a commit message using AI.
- `complete`: Implements shell completion for the CLI tool.

The `external` module includes the following submodules:
- `bitwarden`: Provides a function to retrieve notes from Bitwarden.
- `git`: Provides functions for interacting with Git, including committing changes and retrieving diffs and status.

The main entry point of the application is in the `main.rs` file, which parses command-line arguments and executes the appropriate subcommand.

This commit sets up the basic structure of the project and lays the foundation for implementing the AI-powered commit message generation functionality.

Release-As: 0.0.0
  • Loading branch information
liblaf committed Nov 17, 2023
0 parents commit 6040a79
Show file tree
Hide file tree
Showing 20 changed files with 2,693 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2

updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
94 changes: 94 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI/CD

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install GNU Softwares
uses: liblaf/install-action@main
with:
brew: coreutils gnu-sed make
choco: gnuwin32-coreutils.install make sed
- name: Install Rust Toolchain
run: rustup default stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build
run: make dist
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ runner.arch }}
path: dist/*
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
releases-created: ${{ steps.release.outputs.releases_created }}
tag-name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
name: Create GitHub Release
uses: google-github-actions/release-please-action@v3
with:
release-type: rust

publish:
name: Publish
needs:
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Git Pull
run: git pull
- name: Install Rust Toolchain
run: rustup default stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Publish to Crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

upload:
name: Upload Release Assets
needs:
- build
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload Release Assets
uses: softprops/action-gh-release@master
with:
tag_name: ${{ needs.release.outputs.tag-name }}
files: artifacts/**/*
25 changes: 25 additions & 0 deletions .github/workflows/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Template

on:
schedule:
- cron: 0 3 * * 0
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}

jobs:
template:
name: Template
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync Repository
uses: liblaf/template@main
- name: Git Commit
run: |-
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --all
git commit --message="ci: sync with template repository" || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
159 changes: 159 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
ci:
autofix_commit_msg: |-
ci(pre-commit): auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autoupdate_commit_msg: |-
ci(pre-commit): pre-commit autoupdate
skip:
- cargo-check
- clippy
- fmt
- go-build-mod
- go-build-repo-mod
- go-mod-tidy
- go-mod-tidy-repo
- go-test-mod
- go-test-repo-mod
- go-vet-mod
- go-vet-repo-mod
- latexindent
- poetry-lock

repos:
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.12.0
hooks:
- id: commitizen
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: cargo-check
- id: clippy
- id: fmt
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.4
hooks:
- id: clang-format
types_or:
- c
- c++
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
stages:
- pre-commit
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
args:
- --unsafe
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- id: black-jupyter
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args:
- --profile=black
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.1
hooks:
- id: check-azure-pipelines
- id: check-bamboo-spec
- id: check-buildkite
- id: check-dependabot
- id: check-github-actions
- id: check-github-workflows
- id: check-gitlab-ci
- id: check-readthedocs
- id: check-renovate
- id: check-travis
- repo: https://github.com/python-poetry/poetry
rev: 1.7.0
hooks:
- id: poetry-check
- id: poetry-export
args:
- --output=requirements.txt
- --without-hashes
- --without-urls
- id: poetry-lock
files: pyproject.toml
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-2
hooks:
- id: shfmt-src
files: (\.sh|\.zsh|\.zsh-theme|envrc|zshrc)(\.tmpl)?$
types:
- text
args:
- --write
- --simplify
- --indent=2
- --case-indent
- repo: https://github.com/sirosen/texthooks
rev: 0.6.2
hooks:
- id: fix-ligatures
- id: fix-smartquotes
- id: fix-spaces
- id: forbid-bidi-controls
- id: macro-expand
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-build-mod
- id: go-build-repo-mod
- id: go-fmt
- id: go-fmt-repo
- id: go-mod-tidy
- id: go-mod-tidy-repo
- id: go-test-mod
- id: go-test-repo-mod
- id: go-vet-mod
- id: go-vet-repo-mod
- repo: local
hooks:
- id: latexindent
name: Pretty LaTeX
entry: latexindent
language: system
files: .(tex|sty|cls|bib)$
types:
- text
args:
- --overwriteIfDifferent
- --silent
- --cruft=/tmp
- --modifylinebreaks
- --GCString
Loading

0 comments on commit 6040a79

Please sign in to comment.