From d333c6b92a9b1f800ecc62817451c2f39400ddce Mon Sep 17 00:00:00 2001 From: zoxilsi Date: Sun, 27 Jul 2025 11:35:43 +0530 Subject: [PATCH 1/4] ci: add GitHub Actions for commitlint and DCO checks --- .github/workflows/commitlint.yml | 33 ++++++++++++++++++++++++++++++++ .github/workflows/dco.yml | 20 +++++++++++++++++++ commitlint.config.js | 26 +++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 .github/workflows/commitlint.yml create mode 100644 .github/workflows/dco.yml create mode 100644 commitlint.config.js diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..0e3fb34 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,33 @@ +name: Commitlint + +on: + pull_request: + branches: [ master, main ] + +jobs: + commitlint: + runs-on: ubuntu-latest + name: Check commit messages + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: | + npm install --save-dev @commitlint/config-conventional @commitlint/cli + + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' + run: npx commitlint --from HEAD~1 --to HEAD --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml new file mode 100644 index 0000000..1858f26 --- /dev/null +++ b/.github/workflows/dco.yml @@ -0,0 +1,20 @@ +name: DCO Check + +on: + pull_request: + branches: [ master, main ] + +jobs: + dco-check: + runs-on: ubuntu-latest + name: Developer Certificate of Origin Check + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: DCO Check + uses: dcoapp/dco@v1.0.4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..2cb458d --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,26 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + [ + 'build', + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test' + ] + ], + 'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']], + 'subject-empty': [2, 'never'], + 'subject-full-stop': [2, 'never', '.'], + 'header-max-length': [2, 'always', 72] + } +}; From 3b6d83001c87ab457fe8878a472340afb045ad07 Mon Sep 17 00:00:00 2001 From: zoxilsi Date: Sun, 27 Jul 2025 22:45:51 +0530 Subject: [PATCH 2/4] feat: enhance DCO workflow and add comprehensive contribution guidelines Signed-off-by: zoxilsi --- .github/DCO.md | 74 ++++++++++ .github/pull_request_template.md | 79 +++++++++++ .github/workflows/commitlint.yml | 8 +- .github/workflows/dco.yml | 38 ++++- CONTRIBUTING.md | 230 +++++++++++++++++++++++++++++++ README.md | 17 ++- commitlint.config.js | 30 ++-- 7 files changed, 454 insertions(+), 22 deletions(-) create mode 100644 .github/DCO.md create mode 100644 .github/pull_request_template.md create mode 100644 CONTRIBUTING.md diff --git a/.github/DCO.md b/.github/DCO.md new file mode 100644 index 0000000..afbfe86 --- /dev/null +++ b/.github/DCO.md @@ -0,0 +1,74 @@ +# Developer Certificate of Origin (DCO) + +## What is DCO? + +The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. + +## How to Sign Off Your Commits + +### For New Commits +Use the `-s` flag when committing: +```bash +git commit -s -m "your commit message" +``` + +### For Existing Commits + +#### Single Commit +```bash +git commit --amend -s +``` + +#### Multiple Commits +```bash +# For the last n commits +git rebase --signoff HEAD~n + +# For all commits in your branch +git rebase --signoff main +``` + +### Manual Sign-off +Add this line to your commit message: +``` +Signed-off-by: Your Name +``` + +## DCO Text + +By making a contribution to this project, I certify that: + +1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or + +2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or + +3. The contribution was provided directly to me by some other person who certified (1), (2) or (3) and I have not modified it. + +4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. + +## Troubleshooting + +### Check if commits are signed +```bash +git log --show-signature +``` + +### Configure git for automatic sign-off +```bash +git config --global user.name "Your Name" +git config --global user.email "your.email@example.com" +``` + +### Create an alias for signed commits +```bash +git config --global alias.cs 'commit -s' +``` + +Then use `git cs -m "message"` instead of `git commit -s -m "message"`. + +## Why DCO? + +- **Legal Protection**: Provides legal protection for both contributors and maintainers +- **Simple Process**: Lightweight alternative to Contributor License Agreements (CLAs) +- **Transparency**: Creates a clear audit trail of contributions +- **Industry Standard**: Used by major projects like Linux kernel, Docker, and many CNCF projects diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..7aa7b41 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,79 @@ +## πŸ“‹ Pull Request Description + +### What does this PR do? + + +### Changes Made + +- [ ] +- [ ] +- [ ] + +### Type of Change + +- [ ] πŸ› Bug fix (non-breaking change that fixes an issue) +- [ ] ✨ New feature (non-breaking change that adds functionality) +- [ ] πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] πŸ“š Documentation update +- [ ] 🎨 Code style/formatting changes +- [ ] ♻️ Code refactoring (no functional changes) +- [ ] ⚑ Performance improvements +- [ ] πŸ§ͺ Test coverage improvements +- [ ] πŸ”§ Build/CI changes + +## πŸ§ͺ Testing + +### How Has This Been Tested? + +- [ ] Unit tests pass +- [ ] Integration tests pass +- [ ] Manual testing completed +- [ ] Cross-platform testing (if applicable) + +### Test Configuration +- OS: +- Node.js version: +- Rust version: + +## πŸ“ Checklist + +### Code Quality +- [ ] My code follows the project's style guidelines +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes + +### DCO and Commit Requirements +- [ ] **All commits are signed off with DCO** (`git commit -s`) +- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format +- [ ] No merge commits (rebased/squashed if needed) + +### Documentation +- [ ] I have updated the README.md if needed +- [ ] I have updated relevant code comments +- [ ] I have added/updated JSDoc comments for new functions + +## πŸ”— Related Issues + +Closes # +Related to # + +## πŸ“Έ Screenshots (if applicable) + + +## ⚠️ Breaking Changes + + +## πŸ“‹ Additional Notes + + +--- + +### For Reviewers +- [ ] Code review completed +- [ ] Tests verified +- [ ] Documentation reviewed +- [ ] DCO compliance verified diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 0e3fb34..32ad532 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -2,6 +2,7 @@ name: Commitlint on: pull_request: + types: [opened, synchronize, reopened] branches: [ master, main ] jobs: @@ -22,12 +23,7 @@ jobs: - name: Install dependencies run: | - npm install --save-dev @commitlint/config-conventional @commitlint/cli - - - name: Validate current commit (last commit) with commitlint - if: github.event_name == 'push' - run: npx commitlint --from HEAD~1 --to HEAD --verbose + npm install --no-save @commitlint/config-conventional @commitlint/cli - name: Validate PR commits with commitlint - if: github.event_name == 'pull_request' run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml index 1858f26..ab6266a 100644 --- a/.github/workflows/dco.yml +++ b/.github/workflows/dco.yml @@ -1,20 +1,54 @@ +# Developer Certificate of Origin (DCO) Check +# This workflow ensures all commits are signed off according to DCO requirements +# DCO helps establish a clear chain of custody for contributions + name: DCO Check on: pull_request: + # Only run on relevant PR events to save CI resources + types: [opened, synchronize, reopened] + # Target branches where DCO compliance is required branches: [ master, main ] jobs: dco-check: runs-on: ubuntu-latest name: Developer Certificate of Origin Check + + # Add timeout to prevent hanging workflows + timeout-minutes: 5 + steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 with: + # Fetch full history to check all commits in PR fetch-depth: 0 + # Use token for private repos if needed + token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check + - name: Run DCO Check uses: dcoapp/dco@v1.0.4 with: github-token: ${{ secrets.GITHUB_TOKEN }} + # Enable verbose output for better debugging + verbose: true + + - name: DCO Check Results + if: failure() + run: | + echo "❌ DCO check failed!" + echo "All commits must be signed off with 'Signed-off-by: Your Name '" + echo "To fix this, you can:" + echo "1. Add 'Signed-off-by' to your commit messages manually" + echo "2. Use 'git commit -s' for future commits" + echo "3. Amend existing commits with 'git commit --amend -s'" + echo "4. For multiple commits, use 'git rebase --signoff HEAD~n' where n is the number of commits" + exit 1 + + - name: DCO Check Success + if: success() + run: | + echo "βœ… All commits are properly signed off!" + echo "DCO compliance verified successfully." diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7691beb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,230 @@ +# Contributing to Term + +Thank you for your interest in contributing to Term! This guide will help you get started with the contribution process. + +## πŸš€ Quick Start + +1. **Fork the repository** on GitHub +2. **Clone your fork** locally: + ```bash + git clone https://github.com/YOUR_USERNAME/term.git + cd term + ``` +3. **Set up the development environment**: + ```bash + # Install Node.js dependencies + npm install + + # Install Rust (if not already installed) + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source ~/.cargo/env + + # Install Tauri CLI + cargo install tauri-cli + ``` +4. **Create a new branch** for your feature: + ```bash + git checkout -b feature/your-feature-name + ``` + +## πŸ“‹ Development Guidelines + +### Code Style +- **Frontend**: Follow TypeScript best practices, use functional components with hooks +- **Backend**: Follow Rust conventions and use `cargo fmt` for formatting +- **Commit Messages**: Use [Conventional Commits](https://www.conventionalcommits.org/) format +- **DCO**: All commits must be signed off (see below) + +### Testing +- Run tests before submitting: `npm test` +- Add tests for new features +- Ensure cross-platform compatibility + +### Documentation +- Update README.md for significant changes +- Add JSDoc comments for new functions +- Update inline code comments + +## βš–οΈ Developer Certificate of Origin (DCO) + +### What is DCO? +The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they have the right to submit their code under the project's license. + +### Required Sign-off +**All commits must include a DCO sign-off.** This is enforced by our CI/CD pipeline. + +### How to Sign Off Commits + +#### New Commits +```bash +git commit -s -m "feat: add new terminal command support" +``` + +#### Existing Commits +```bash +# For the last commit +git commit --amend -s + +# For multiple commits (last 3 in this example) +git rebase --signoff HEAD~3 + +# For all commits in your branch (assuming you branched from main) +git rebase --signoff main +``` + +#### Manual Sign-off +Add this line to your commit message: +``` +Signed-off-by: Your Name +``` + +### Git Configuration +Set up your git identity: +```bash +git config --global user.name "Your Full Name" +git config --global user.email "your.email@example.com" +``` + +Create an alias for signed commits: +```bash +git config --global alias.cs 'commit -s' +# Now you can use: git cs -m "your message" +``` + +## πŸ”„ Contribution Workflow + +### 1. Create an Issue (Optional but Recommended) +- Check if an issue already exists +- For bugs: include reproduction steps, environment details +- For features: describe the use case and proposed solution + +### 2. Development Process +```bash +# Keep your fork updated +git remote add upstream https://github.com/zoxilsi/term.git +git fetch upstream +git checkout main +git merge upstream/main + +# Create your feature branch +git checkout -b feature/amazing-feature + +# Make your changes with signed commits +git add . +git commit -s -m "feat: add amazing feature" + +# Run tests +npm test +npm run lint +npm run build + +# Push to your fork +git push origin feature/amazing-feature +``` + +### 3. Submit a Pull Request +1. Go to GitHub and create a Pull Request +2. Fill out the PR template completely +3. Ensure all CI checks pass +4. Respond to review feedback promptly + +## πŸ§ͺ Testing Your Changes + +### Frontend Tests +```bash +npm test # Run all tests +npm run test:watch # Run tests in watch mode +npm run test:coverage # Generate coverage report +``` + +### Backend Tests +```bash +cd src-tauri +cargo test # Run Rust tests +cargo test -- --nocapture # Run with output +``` + +### Manual Testing +```bash +npm run tauri dev # Start development server +``` + +## 🏷️ Commit Message Format + +We follow [Conventional Commits](https://www.conventionalcommits.org/): + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +Signed-off-by: Your Name +``` + +### Types +- `feat`: New features +- `fix`: Bug fixes +- `docs`: Documentation changes +- `style`: Code style changes (formatting, etc.) +- `refactor`: Code refactoring +- `test`: Adding or updating tests +- `chore`: Maintenance tasks +- `ci`: CI/CD changes +- `perf`: Performance improvements +- `build`: Build system changes + +### Examples +```bash +git commit -s -m "feat: add AI command autocompletion" +git commit -s -m "fix: resolve terminal output formatting issue" +git commit -s -m "docs: update installation instructions" +git commit -s -m "test: add unit tests for command processor" +``` + +## πŸ› Reporting Issues + +### Bug Reports +Include: +- Steps to reproduce +- Expected vs actual behavior +- Environment details (OS, Node.js version, etc.) +- Screenshots/logs if applicable + +### Feature Requests +Include: +- Use case description +- Proposed solution +- Alternative solutions considered +- Additional context + +## πŸ“ž Getting Help + +- **Issues**: Use GitHub Issues for bugs and feature requests +- **Discussions**: Use GitHub Discussions for questions and general discussion +- **Code Review**: Maintainers will review PRs and provide feedback + +## 🎯 Areas for Contribution + +- πŸ› **Bug Fixes**: Check the issues labeled `bug` +- ✨ **Features**: Check issues labeled `enhancement` or `feature` +- πŸ“š **Documentation**: Improve README, code comments, or add examples +- πŸ§ͺ **Testing**: Increase test coverage or add integration tests +- 🎨 **UI/UX**: Improve the terminal interface and user experience +- ⚑ **Performance**: Optimize command execution or UI responsiveness + +## ⚠️ Important Notes + +1. **DCO Compliance**: Non-compliant PRs will be automatically rejected +2. **Code Review**: All changes require review before merging +3. **Breaking Changes**: Must be discussed in an issue first +4. **Backwards Compatibility**: Maintain compatibility when possible +5. **Cross-Platform**: Test on different operating systems when relevant + +## πŸ™ Thank You + +Your contributions help make Term better for everyone. We appreciate your time and effort in improving this project! + +--- + +For more details about DCO, see [.github/DCO.md](.github/DCO.md). diff --git a/README.md b/README.md index f138a43..4f8c581 100644 --- a/README.md +++ b/README.md @@ -132,16 +132,27 @@ npx tauri dev # or npm run tauri dev Contributions are welcome! To get started: 1. Fork the repository 2. Create a new branch (`git checkout -b feature/your-feature`) -3. Commit your changes (`git commit -m 'Add feature'`) +3. Commit your changes with DCO sign-off (`git commit -s -m 'Add feature'`) 4. Push to your fork (`git push origin feature/your-feature`) 5. Open a Pull Request ### Guidelines - Follow the existing code style (see ESLint/Prettier configs) -- Write clear commit messages +- Write clear commit messages using [Conventional Commits](https://www.conventionalcommits.org/) +- **All commits must be signed off** (see [DCO requirements](.github/DCO.md)) - Add tests for new features when possible - Be respectful in code reviews and discussions -- Do not push the code without manually testing and verifying it. +- Do not push the code without manually testing and verifying it + +### Developer Certificate of Origin (DCO) +This project requires all contributors to sign off their commits with the Developer Certificate of Origin (DCO). This certifies that you have the right to submit your contribution under the project's license. + +**How to sign off commits:** +```bash +git commit -s -m "your commit message" +``` + +For more details, see our [DCO documentation](.github/DCO.md). --- diff --git a/commitlint.config.js b/commitlint.config.js index 2cb458d..40f29a0 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,26 +1,34 @@ +// Commitlint configuration for conventional commit messages +// This configuration ensures commit messages follow conventional commit standards module.exports = { + // Extend the conventional commit configuration extends: ['@commitlint/config-conventional'], rules: { + // Define allowed commit types (build, chore, ci, docs, feat, fix, etc.) 'type-enum': [ 2, 'always', [ - 'build', - 'chore', - 'ci', - 'docs', - 'feat', - 'fix', - 'perf', - 'refactor', - 'revert', - 'style', - 'test' + 'build', // Changes that affect the build system or external dependencies + 'chore', // Other changes that don't modify src or test files + 'ci', // Changes to CI configuration files and scripts + 'docs', // Documentation only changes + 'feat', // A new feature + 'fix', // A bug fix + 'perf', // A code change that improves performance + 'refactor', // A code change that neither fixes a bug nor adds a feature + 'revert', // Reverts a previous commit + 'style', // Changes that do not affect the meaning of the code + 'test' // Adding missing tests or correcting existing tests ] ], + // Prevent certain cases in commit subject (no start-case, pascal-case, or upper-case) 'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']], + // Commit subject cannot be empty 'subject-empty': [2, 'never'], + // Commit subject should not end with a period 'subject-full-stop': [2, 'never', '.'], + // Commit header should not exceed 72 characters 'header-max-length': [2, 'always', 72] } }; From 1e05af79923d7defa3fd3b600b3d69421033e253 Mon Sep 17 00:00:00 2001 From: Sapate Vaibhav Date: Mon, 11 Aug 2025 13:54:39 +0530 Subject: [PATCH 3/4] Delete .github/pull_request_template.md --- .github/pull_request_template.md | 79 -------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 7aa7b41..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,79 +0,0 @@ -## πŸ“‹ Pull Request Description - -### What does this PR do? - - -### Changes Made - -- [ ] -- [ ] -- [ ] - -### Type of Change - -- [ ] πŸ› Bug fix (non-breaking change that fixes an issue) -- [ ] ✨ New feature (non-breaking change that adds functionality) -- [ ] πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] πŸ“š Documentation update -- [ ] 🎨 Code style/formatting changes -- [ ] ♻️ Code refactoring (no functional changes) -- [ ] ⚑ Performance improvements -- [ ] πŸ§ͺ Test coverage improvements -- [ ] πŸ”§ Build/CI changes - -## πŸ§ͺ Testing - -### How Has This Been Tested? - -- [ ] Unit tests pass -- [ ] Integration tests pass -- [ ] Manual testing completed -- [ ] Cross-platform testing (if applicable) - -### Test Configuration -- OS: -- Node.js version: -- Rust version: - -## πŸ“ Checklist - -### Code Quality -- [ ] My code follows the project's style guidelines -- [ ] I have performed a self-review of my code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation -- [ ] My changes generate no new warnings -- [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] New and existing unit tests pass locally with my changes - -### DCO and Commit Requirements -- [ ] **All commits are signed off with DCO** (`git commit -s`) -- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format -- [ ] No merge commits (rebased/squashed if needed) - -### Documentation -- [ ] I have updated the README.md if needed -- [ ] I have updated relevant code comments -- [ ] I have added/updated JSDoc comments for new functions - -## πŸ”— Related Issues - -Closes # -Related to # - -## πŸ“Έ Screenshots (if applicable) - - -## ⚠️ Breaking Changes - - -## πŸ“‹ Additional Notes - - ---- - -### For Reviewers -- [ ] Code review completed -- [ ] Tests verified -- [ ] Documentation reviewed -- [ ] DCO compliance verified From d4062e1666e8c193e674c961cb1313995e5a637f Mon Sep 17 00:00:00 2001 From: Sapate Vaibhav Date: Mon, 11 Aug 2025 13:58:40 +0530 Subject: [PATCH 4/4] Update CONTRIBUTING.md --- CONTRIBUTING.md | 444 ++++++++++++------------------------------------ 1 file changed, 111 insertions(+), 333 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index acd05d7..8bb6dc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,470 +2,248 @@ Thank you for your interest in contributing to Term! This guide will help you get started with the contribution process. +--- + ## πŸš€ Quick Start 1. **Fork the repository** on GitHub 2. **Clone your fork** locally: + ```bash git clone https://github.com/YOUR_USERNAME/term.git cd term ``` 3. **Set up the development environment**: + ```bash # Install Node.js dependencies npm install - + # Install Rust (if not already installed) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env - + # Install Tauri CLI cargo install tauri-cli ``` 4. **Create a new branch** for your feature: + ```bash - git checkout -b feature/your-feature-name + git checkout -b feat/your-feature-name ``` +--- + ## πŸ“‹ Development Guidelines ### Code Style -- **Frontend**: Follow TypeScript best practices, use functional components with hooks -- **Backend**: Follow Rust conventions and use `cargo fmt` for formatting -- **Commit Messages**: Use [Conventional Commits](https://www.conventionalcommits.org/) format -- **DCO**: All commits must be signed off (see below) + +* **Frontend**: TypeScript best practices, functional components + hooks +* **Backend**: Rust conventions, run `cargo fmt` before commits +* **Commits**: Follow [Conventional Commits](https://www.conventionalcommits.org/) +* **DCO**: All commits must be signed off (details below) ### Testing -- Run tests before submitting: `npm test` -- Add tests for new features -- Ensure cross-platform compatibility + +* Run: `npm test` +* Add tests for new features +* Ensure cross-platform compatibility ### Documentation -- Update README.md for significant changes -- Add JSDoc comments for new functions -- Update inline code comments + +* Update README.md for major changes +* Add JSDoc for new functions +* Maintain inline comments + +--- ## βš–οΈ Developer Certificate of Origin (DCO) ### What is DCO? -The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they have the right to submit their code under the project's license. + +The DCO is a lightweight way for contributors to certify they have the right to submit code under the project's license. ### Required Sign-off -**All commits must include a DCO sign-off.** This is enforced by our CI/CD pipeline. -### How to Sign Off Commits +**All commits must be signed off.** This is enforced by CI/CD. #### New Commits + ```bash -git commit -s -m "feat: add new terminal command support" +git commit -s -m "feat: add new feature" ``` #### Existing Commits + ```bash -# For the last commit +# Last commit git commit --amend -s -# For multiple commits (last 3 in this example) +# Multiple commits git rebase --signoff HEAD~3 -# For all commits in your branch (assuming you branched from main) +# Entire branch git rebase --signoff main ``` #### Manual Sign-off -Add this line to your commit message: + ``` Signed-off-by: Your Name ``` -### Git Configuration -Set up your git identity: -```bash -git config --global user.name "Your Full Name" -git config --global user.email "your.email@example.com" -``` +#### Git Config -Create an alias for signed commits: ```bash +git config --global user.name "Your Name" +git config --global user.email "your.email@example.com" git config --global alias.cs 'commit -s' -# Now you can use: git cs -m "your message" ``` +--- + ## πŸ”„ Contribution Workflow -### 1. Create an Issue (Optional but Recommended) -- Check if an issue already exists -- For bugs: include reproduction steps, environment details -- For features: describe the use case and proposed solution +### 1. Create an Issue (Optional) + +* Check existing issues +* Bugs: include steps, environment, logs +* Features: describe use case + solution + +### 2. Development -### 2. Development Process ```bash -# Keep your fork updated git remote add upstream https://github.com/zoxilsi/term.git git fetch upstream git checkout main git merge upstream/main -# Create your feature branch -git checkout -b feature/amazing-feature +# Feature branch +git checkout -b feat/amazing-feature -# Make your changes with signed commits +# Signed commit git add . -git commit -s -m "feat: add amazing feature" +git commit -s -m "feat: amazing feature" -# Run tests npm test npm run lint npm run build -# Push to your fork -git push origin feature/amazing-feature +git push origin feat/amazing-feature ``` -### 3. Submit a Pull Request -1. Go to GitHub and create a Pull Request -2. Fill out the PR template completely -3. Ensure all CI checks pass -4. Respond to review feedback promptly - -## πŸ§ͺ Testing Your Changes - -### Frontend Tests -```bash -npm test # Run all tests -npm run test:watch # Run tests in watch mode -npm run test:coverage # Generate coverage report -``` - -### Backend Tests -```bash -cd src-tauri -cargo test # Run Rust tests -cargo test -- --nocapture # Run with output -``` - -### Manual Testing -```bash -npm run tauri dev # Start development server -``` - -## 🏷️ Commit Message Format - -We follow [Conventional Commits](https://www.conventionalcommits.org/): - -``` -[optional scope]: - -[optional body] - -[optional footer(s)] -Signed-off-by: Your Name -``` - -### Types -- `feat`: New features -- `fix`: Bug fixes -- `docs`: Documentation changes -- `style`: Code style changes (formatting, etc.) -- `refactor`: Code refactoring -- `test`: Adding or updating tests -- `chore`: Maintenance tasks -- `ci`: CI/CD changes -- `perf`: Performance improvements -- `build`: Build system changes - -### Examples -```bash -git commit -s -m "feat: add AI command autocompletion" -git commit -s -m "fix: resolve terminal output formatting issue" -git commit -s -m "docs: update installation instructions" -git commit -s -m "test: add unit tests for command processor" -``` - -## πŸ› Reporting Issues - -### Bug Reports -Include: -- Steps to reproduce -- Expected vs actual behavior -- Environment details (OS, Node.js version, etc.) -- Screenshots/logs if applicable - -### Feature Requests -Include: -- Use case description -- Proposed solution -- Alternative solutions considered -- Additional context - -## πŸ“ž Getting Help - -- **Issues**: Use GitHub Issues for bugs and feature requests -- **Discussions**: Use GitHub Discussions for questions and general discussion -- **Code Review**: Maintainers will review PRs and provide feedback - -## 🎯 Areas for Contribution - -- πŸ› **Bug Fixes**: Check the issues labeled `bug` -- ✨ **Features**: Check issues labeled `enhancement` or `feature` -- πŸ“š **Documentation**: Improve README, code comments, or add examples -- πŸ§ͺ **Testing**: Increase test coverage or add integration tests -- 🎨 **UI/UX**: Improve the terminal interface and user experience -- ⚑ **Performance**: Optimize command execution or UI responsiveness - -## ⚠️ Important Notes - -1. **DCO Compliance**: Non-compliant PRs will be automatically rejected -2. **Code Review**: All changes require review before merging -3. **Breaking Changes**: Must be discussed in an issue first -4. **Backwards Compatibility**: Maintain compatibility when possible -5. **Cross-Platform**: Test on different operating systems when relevant - -## πŸ™ Thank You - -Your contributions help make Term better for everyone. We appreciate your time and effort in improving this project! - ---- - -For more details about DCO, see [.github/DCO.md](.github/DCO.md). -======= -# πŸ‘‹ Welcome to the `term` Project – Contributing Guide - -[![Contributing](https://img.shields.io/badge/Contribute-Guidelines-blue.svg)](./CONTRIBUTING.md) +### 3. Pull Request - -Thank you for showing interest in contributing to `term` – an AI-powered, cross-platform terminal assistant built with **Tauri**, **React**, **Rust**, and **TypeScript**. Your contributions help improve the tool and make it more robust and accessible for the developer community. πŸŒπŸ’» +1. Open PR on GitHub +2. Fill PR template +3. Ensure CI passes +4. Address review feedback --- -## πŸš€ Project Overview - -`term` provides a minimal terminal-like interface enhanced with AI features. It supports: -- Shell command execution -- Natural language queries -- Secure API key management -- Autocompletion -- Cross-platform support (Linux, Windows, macOS) - -For a full overview, see the [README.md](./README.md) - ---- - -## πŸ§‘β€πŸ’» How Can You Contribute? - -You can contribute in multiple ways: -- πŸ› Report or fix bugs -- 🧩 Suggest or implement new features -- πŸ§ͺ Add tests -- πŸ“ Improve documentation -- 🌐 Optimize accessibility and cross-platform behavior - ---- - -## 🧰 Development Setup - -### βœ… Prerequisites - -Make sure these are installed: - -| Tool | Usage | -|--------------|------------------------------| -| Node.js β‰₯ v18 | Frontend build system | -| pnpm (preferred) or npm | Dependency management | -| Rust | Backend (Tauri CLI & commands) | -| Tauri CLI | Desktop application interface | -| Git | Version control | +## πŸ§ͺ Testing Your Changes -### πŸ§ͺ OS-specific Dependencies +### Frontend -#### 🐧 Ubuntu/Debian: ```bash -sudo apt update -sudo apt install build-essential libwebkit2gtk-4.1-dev librsvg2-dev +npm test +npm run test:watch +npm run test:coverage ``` -#### πŸͺŸ Windows: -- Install [Rust via rustup](https://rustup.rs/) -- Install Node.js -- Install Visual Studio Build Tools (with C++ workload) -- Follow [Tauri Windows prerequisites](https://tauri.app/v1/guides/getting-started/prerequisites) - ---- - -## βš™οΈ Setup Steps +### Backend ```bash -# 1. Fork the repo -git clone https://github.com//term.git -cd term - -# 2. Install dependencies -pnpm install # or npm install - -# 3. Install Rust and Tauri CLI -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -cargo install create-tauri-app tauri-cli - -# 4. Run the project -npx tauri dev # or npm run tauri dev +cd src-tauri +cargo test +cargo test -- --nocapture ``` ---- - -## πŸ” API Key Management - -When the app launches for the first time, you’ll be prompted to enter your OpenAI API key. - -### πŸ”‘ Manual Commands -- **Set API key**: - ```bash - setapikey sk-xxxx - ``` -- **Reset API key**: - ```bash - resetapikey - ``` - -Stored securely in a `.term/` folder at the project root. - ---- - -## πŸ“ Project Structure +### Manual ```bash -term/ -β”œβ”€β”€ src/ # React frontend (UI, logic, hooks) -β”œβ”€β”€ src-tauri/ # Rust backend (commands, API key logic) -β”œβ”€β”€ public/ # Static assets -β”œβ”€β”€ __tests__/ # Unit and integration tests -β”œβ”€β”€ .github/ # GitHub workflows & issue templates -β”œβ”€β”€ .husky/ # Pre-commit hooks -β”œβ”€β”€ package.json # Scripts & dependencies -β”œβ”€β”€ tailwind.config.js -└── vite.config.ts +npm run tauri dev ``` --- -## ✍️ Git & Branching Workflow +## 🏷️ Commit Message Format -### πŸͺ’ Create a Branch -Use a descriptive name: -```bash -git checkout -b feat/ ``` +[scope]: description -Examples: -- `feat/command-history` -- `fix/macos-crash` -- `docs/update-readme` - ---- - -### βœ… Commit Message Guidelines (Conventional Commits) - -| Type | Description | -|---------|----------------------------------------| -| feat | New feature | -| fix | Bug fix | -| docs | Documentation only changes | -| style | Formatting, missing semicolons, etc. | -| refactor| Code refactor without behavior change | -| test | Adding or updating tests | -| chore | Misc tasks (configs, deps) | +[optional body] -Example: -``` -feat: add autocomplete for shell commands +[optional footer] +Signed-off-by: Your Name ``` ---- - -## πŸ§ͺ Linting, Formatting, and Testing +Types: -### βœ… Code Formatting -Before committing: -```bash -pnpm format -``` +* `feat` | `fix` | `docs` | `style` | `refactor` | `test` | `chore` | `ci` | `perf` | `build` -### βœ… Linting -```bash -pnpm lint -``` +Examples: -### πŸ§ͺ Run Tests ```bash -pnpm test +git commit -s -m "feat: add AI autocompletion" +git commit -s -m "fix: resolve output formatting" ``` -Make sure all tests pass before opening a PR. - --- -## 🧡 Pull Request Process - -1. Push your branch: - ```bash - git push origin feat/your-feature-name - ``` - -2. Go to your fork on GitHub β†’ Click **β€œCompare & Pull Request”** +## πŸ› Reporting Issues -3. Fill in the PR template: - - Title: `feat: improve key management UX` - - Description: What, why, how - - Link related issues (e.g., `Closes #30`) - - Add screenshots if visual +### Bugs -4. Submit for review. +Include: ---- +* Steps to reproduce +* Expected vs actual +* Environment details +* Screenshots/logs -## 🀝 Code Review Expectations +### Features -Your PR will be reviewed for: -- Clarity of changes -- Coding standards (TS/React/Rust) -- Proper commit style -- Manual verification & working locally +Include: -Be open to suggestions and iterate based on feedback. πŸ˜„ +* Use case +* Proposed solution +* Alternatives +* Extra context --- -## πŸ“¦ Before You Push +## πŸ“ž Getting Help -- βœ… Tested locally (`npx tauri dev`) -- βœ… Linting and formatting passed -- βœ… Commit messages follow convention -- βœ… PR links to relevant issue +* **Issues**: Bug reports & feature requests +* **Discussions**: Q\&A & ideas +* **Reviews**: Feedback on PRs --- -## πŸ§‘β€βš–οΈ Code of Conduct +## 🎯 Areas for Contribution -We follow a standard [Code of Conduct](./CODE_OF_CONDUCT.md). Please be respectful, inclusive, and professional in all discussions and contributions. +* Bug fixes +* Features +* Documentation +* Testing +* UI/UX +* Performance improvements --- -## πŸ’‘ Tips for GSSoC Contributors +## ⚠️ Notes -- Check issues labeled `good first issue`, `level1`, or `documentation` -- Ask for assignment before starting -- Engage respectfully with maintainers -- Link your Discord or GitHub profile in the PR (if allowed) +1. PRs without DCO will be rejected +2. All code changes need review +3. Breaking changes require discussion +4. Maintain backwards compatibility +5. Test on multiple OS where possible --- -## πŸ“¬ Need Help? - -- Open a GitHub Discussion or Issue -- Tag maintainers or project leads -- Reach out via GSSoC channels - ---- +## πŸ™ Thank You -## πŸ™ Thank You for Contributing! +Your contributions make Term better for everyone! -Your input makes a big difference. We're excited to build this with you. Happy coding! πŸš€ \ No newline at end of file +For more DCO details, see [.github/DCO.md](.github/DCO.md).