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/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..32ad532 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,29 @@ +name: Commitlint + +on: + pull_request: + types: [opened, synchronize, reopened] + 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 --no-save @commitlint/config-conventional @commitlint/cli + + - name: Validate PR commits with commitlint + 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..ab6266a --- /dev/null +++ b/.github/workflows/dco.yml @@ -0,0 +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 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: 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 index c0083cd..8bb6dc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,240 +1,249 @@ -# πŸ‘‹ Welcome to the `term` Project – Contributing Guide +# Contributing to Term -[![Contributing](https://img.shields.io/badge/Contribute-Guidelines-blue.svg)](./CONTRIBUTING.md) - - -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. πŸŒπŸ’» +Thank you for your interest in contributing to Term! This guide will help you get started with the contribution process. --- -## πŸš€ Project Overview +## πŸš€ Quick Start -`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) +1. **Fork the repository** on GitHub +2. **Clone your fork** locally: -For a full overview, see the [README.md](./README.md) + ```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 -## πŸ§‘β€πŸ’» How Can You Contribute? + # Install Rust (if not already installed) + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source ~/.cargo/env -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 + # Install Tauri CLI + cargo install tauri-cli + ``` +4. **Create a new branch** for your feature: + + ```bash + git checkout -b feat/your-feature-name + ``` --- -## 🧰 Development Setup +## πŸ“‹ Development Guidelines -### βœ… Prerequisites +### Code Style -Make sure these are installed: +* **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) -| 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 -### πŸ§ͺ OS-specific Dependencies +* Run: `npm test` +* Add tests for new features +* Ensure cross-platform compatibility -#### 🐧 Ubuntu/Debian: -```bash -sudo apt update -sudo apt install build-essential libwebkit2gtk-4.1-dev librsvg2-dev -``` +### Documentation -#### πŸͺŸ 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) +* Update README.md for major changes +* Add JSDoc for new functions +* Maintain inline comments --- -## βš™οΈ Setup Steps +## βš–οΈ Developer Certificate of Origin (DCO) -```bash -# 1. Fork the repo -git clone https://github.com//term.git -cd term +### What is DCO? -# 2. Install dependencies -pnpm install # or npm install +The DCO is a lightweight way for contributors to certify they have the right to submit code under the project's license. -# 3. Install Rust and Tauri CLI -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -cargo install create-tauri-app tauri-cli +### Required Sign-off -# 4. Run the project -npx tauri dev # or npm run tauri dev +**All commits must be signed off.** This is enforced by CI/CD. + +#### New Commits + +```bash +git commit -s -m "feat: add new feature" ``` ---- +#### Existing Commits -## πŸ” API Key Management +```bash +# Last commit +git commit --amend -s -When the app launches for the first time, you’ll be prompted to enter your OpenAI API key. +# Multiple commits +git rebase --signoff HEAD~3 -### πŸ”‘ Manual Commands -- **Set API key**: - ```bash - setapikey sk-xxxx - ``` -- **Reset API key**: - ```bash - resetapikey - ``` +# Entire branch +git rebase --signoff main +``` -Stored securely in a `.term/` folder at the project root. +#### Manual Sign-off ---- +``` +Signed-off-by: Your Name +``` -## πŸ“ Project Structure +#### Git Config ```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 +git config --global user.name "Your Name" +git config --global user.email "your.email@example.com" +git config --global alias.cs 'commit -s' ``` --- -## ✍️ Git & Branching Workflow +## πŸ”„ Contribution Workflow -### πŸͺ’ Create a Branch -Use a descriptive name: -```bash -git checkout -b feat/ -``` +### 1. Create an Issue (Optional) -Examples: -- `feat/command-history` -- `fix/macos-crash` -- `docs/update-readme` +* Check existing issues +* Bugs: include steps, environment, logs +* Features: describe use case + solution ---- +### 2. Development -### βœ… Commit Message Guidelines (Conventional Commits) +```bash +git remote add upstream https://github.com/zoxilsi/term.git +git fetch upstream +git checkout main +git merge upstream/main -| 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) | +# Feature branch +git checkout -b feat/amazing-feature -Example: -``` -feat: add autocomplete for shell commands +# Signed commit +git add . +git commit -s -m "feat: amazing feature" + +npm test +npm run lint +npm run build + +git push origin feat/amazing-feature ``` +### 3. Pull Request + +1. Open PR on GitHub +2. Fill PR template +3. Ensure CI passes +4. Address review feedback + --- -## πŸ§ͺ Linting, Formatting, and Testing +## πŸ§ͺ Testing Your Changes + +### Frontend -### βœ… Code Formatting -Before committing: ```bash -pnpm format +npm test +npm run test:watch +npm run test:coverage ``` -### βœ… Linting +### Backend + ```bash -pnpm lint +cd src-tauri +cargo test +cargo test -- --nocapture ``` -### πŸ§ͺ Run Tests +### Manual + ```bash -pnpm test +npm run tauri dev ``` -Make sure all tests pass before opening a PR. - --- -## 🧡 Pull Request Process +## 🏷️ Commit Message Format -1. Push your branch: - ```bash - git push origin feat/your-feature-name - ``` +``` +[scope]: description + +[optional body] + +[optional footer] +Signed-off-by: Your Name +``` + +Types: -2. Go to your fork on GitHub β†’ Click **β€œCompare & Pull Request”** +* `feat` | `fix` | `docs` | `style` | `refactor` | `test` | `chore` | `ci` | `perf` | `build` -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 +Examples: -4. Submit for review. +```bash +git commit -s -m "feat: add AI autocompletion" +git commit -s -m "fix: resolve output formatting" +``` --- -## 🀝 Code Review Expectations +## πŸ› Reporting Issues -Your PR will be reviewed for: -- Clarity of changes -- Coding standards (TS/React/Rust) -- Proper commit style -- Manual verification & working locally +### Bugs -Be open to suggestions and iterate based on feedback. πŸ˜„ +Include: ---- +* Steps to reproduce +* Expected vs actual +* Environment details +* Screenshots/logs + +### Features -## πŸ“¦ Before You Push +Include: -- βœ… Tested locally (`npx tauri dev`) -- βœ… Linting and formatting passed -- βœ… Commit messages follow convention -- βœ… PR links to relevant issue +* Use case +* Proposed solution +* Alternatives +* Extra context --- -## πŸ§‘β€βš–οΈ Code of Conduct +## πŸ“ž Getting Help -We follow a standard [Code of Conduct](./CODE_OF_CONDUCT.md). Please be respectful, inclusive, and professional in all discussions and contributions. +* **Issues**: Bug reports & feature requests +* **Discussions**: Q\&A & ideas +* **Reviews**: Feedback on PRs --- -## πŸ’‘ Tips for GSSoC Contributors +## 🎯 Areas for Contribution -- 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) +* Bug fixes +* Features +* Documentation +* Testing +* UI/UX +* Performance improvements --- -## πŸ“¬ Need Help? +## ⚠️ Notes -- Open a GitHub Discussion or Issue -- Tag maintainers or project leads -- Reach out via GSSoC channels +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 --- -## πŸ™ Thank You for Contributing! +## πŸ™ Thank You + +Your contributions make Term better for everyone! -Your input makes a big difference. We're excited to build this with you. Happy coding! πŸš€ +For more DCO details, 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 new file mode 100644 index 0000000..40f29a0 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +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', // 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] + } +};