diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..abc1f99 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,30 @@ +--- +name: Bug +about: Report a bug +title: '[Bug] ' +labels: bug +assignees: '' +--- + +**Description** +Briefly: what is the problem? + +**Steps to reproduce** +1. … +2. … + +**Expected** +What should happen? + +**Actual** +What happens instead? + +**Environment** +- OS: +- Java version: +- Terminal (e.g. PowerShell, CMD, IDE): + +**Optional: code snippet** +```java +// minimal example +``` diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..d85d0f1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Question / Discussion + url: https://github.com/jakubbbdev/terminal-ui/discussions + about: For questions and ideas without a concrete bug/feature ticket diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..de60563 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature +about: Suggest an idea or enhancement +title: '' +labels: enhancement +assignees: '' +--- + +**Problem / motivation** +What is this about? What are you missing right now? + +**Proposal** +What should be added or changed? + +**Alternatives** +Have you considered other solutions? + +**Additional context** +Screenshots, examples, links—feel free to attach. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..3993a5c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## Description + + + +## Type of change + +- [ ] Bug fix +- [ ] New feature +- [ ] Refactoring / docs +- [ ] Other + +## Checklist + +- [ ] `./gradlew build` passes locally +- [ ] Relevant tests updated or added (if applicable) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..edd0deb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +# Dependabot: automatic PRs for dependency updates +# https://docs.github.com/en/code-security/dependabot + +version: 2 +updates: + # Gradle dependencies (build.gradle.kts, gradle-wrapper) + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + open-pull-requests-limit: 5 + labels: ["dependencies"] + commit-message: + prefix: "deps" + + # GitHub Actions (*.yml in .github/workflows) + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + labels: ["dependencies", "github-actions"] + commit-message: + prefix: "ci" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..caf7866 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,35 @@ +# CodeQL: static security analysis (free for public repos). +name: CodeQL + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + schedule: + - cron: '0 6 * * 1' + +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: java + + - name: Build (for CodeQL) + run: | + chmod +x gradlew + ./gradlew compileJava --no-daemon + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..0704680 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,22 @@ +# On PRs: checks dependency changes for known vulnerabilities. +# Useful when Dependabot or manual dependency updates are used in PRs. + +name: Dependency Review + +on: + pull_request: + branches: [main, master] + +permissions: + contents: read + pull-requests: write + +jobs: + review: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Dependency Review + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ba7ec7d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +# On push of a version tag (e.g. v1.0.0): build, create GitHub Release, upload JARs. +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: gradle + + - run: chmod +x gradlew && ./gradlew build --no-daemon + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: build/libs/*.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9d92dec --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +Project changes are documented here. + +Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). + +## [Unreleased] + +### Added +- (New features go here) + +### Changed +- (Changes go here) + +### Fixed +- (Bug fixes go here) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6f0b648 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contributing + +Contributions are welcome. + +## Process + +1. Fork the repo and create a branch (e.g. `feature/xyz` or `fix/abc`). +2. Make your changes and test locally: + ```bash + ./gradlew build + ``` +3. Open a pull request against `main`/`master` (fill in the PR template). +4. CI must pass; address review feedback as needed. + +## Code + +- Java 21; follow the existing code style. +- Prefer adding tests in `src/test/` for new functionality. + +## Questions + +For questions and general discussion: [Discussions](https://github.com/jakubbbdev/terminal-ui/discussions). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3352c50 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 terminal-ui 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..faf792d --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# terminal-ui + +Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList, pager, and more. Fluent API, ANSI support, testable. + +[![CI](https://github.com/jakubbbdev/terminal-ui/actions/workflows/ci.yml/badge.svg)](https://github.com/jakubbbdev/terminal-ui/actions/workflows/ci.yml) + +## Requirements + +- **Java 21** +- **Gradle 9.x** (wrapper included) + +## Build & Test + +```bash +./gradlew build +``` + +Run tests: + +```bash +./gradlew test +``` + +Demo (non-interactive): + +```bash +./gradlew run +``` + +Interactive demo (best run in a real terminal): + +```bash +./gradlew runDemo2 +``` + +## Usage (excerpt) + +```java +import dev.jakub.terminal.Terminal; +import dev.jakub.terminal.core.Color; + +// Colored text +Terminal.print("Hello").color(Color.CYAN).bold().println(); + +// Table +Terminal.table() + .header("A", "B") + .row("1", "2") + .row("3", "4") + .print(System.out); + +// Prompt +String name = Terminal.prompt("Name: ").ask(); + +// Menu +String choice = Terminal.menu() + .title("Environment") + .option("Dev").option("Prod") + .select(); +``` + +## License + +See [LICENSE](LICENSE).