From 6f146516a87e2e330e4b2d306bc02bc079c70d88 Mon Sep 17 00:00:00 2001 From: !verity Date: Fri, 13 Mar 2026 20:38:01 +0100 Subject: [PATCH] Set up project configuration: EditorConfig, Git attributes, devcontainer, Release Drafter, SECURITY.md, and README badges --- .devcontainer/devcontainer.json | 20 +++++++++++++++++ .editorconfig | 20 +++++++++++++++++ .gitattributes | 9 ++++++++ .github/release-drafter.yml | 20 +++++++++++++++++ .github/workflows/release-drafter.yml | 22 +++++++++++++++++++ README.md | 16 ++++---------- SECURITY.md | 11 ++++++++++ .../jakub/terminal/interactive/Confirm.java | 2 +- .../jakub/terminal/interactive/Prompt.java | 2 +- 9 files changed, 108 insertions(+), 14 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 SECURITY.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..bcf5bb3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "terminal-ui", + "image": "mcr.microsoft.com/devcontainers/java:1-21-bookworm", + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "21", + "installGradle": "true", + "installMaven": "false" + } + }, + "postCreateCommand": "java -version && ./gradlew --version", + "customizations": { + "vscode": { + "extensions": [ + "vscjava.vscode-java-pack", + "vscjava.vscode-gradle" + ] + } + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..539aa1e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig: consistent style across editors +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{java,kts}] +indent_style = space +indent_size = 4 + +[*.{yml,yaml,md,json}] +indent_size = 2 + +[*.bat] +end_of_line = crlf diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..39a68ae --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# Normalize line endings +* text=auto eol=lf +*.bat text eol=crlf +*.cmd text eol=crlf + +# GitHub linguist: don't count these as language +gradle/wrapper/gradle-wrapper.jar binary +*.jar binary +*.zip binary diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..5479598 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,20 @@ +# Config for release-drafter: how to categorize PRs in draft release notes +# https://github.com/release-drafter/release-drafter + +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' + +categories: + - title: '🚀 Features' + labels: [feature, enhancement] + - title: '🐛 Bug Fixes' + labels: [bug, fix] + - title: '📚 Documentation' + labels: [documentation] + - title: '⬆️ Dependencies' + labels: [dependencies] + - title: 'Other' + labels: ['*'] + +exclude-labels: + - skip-changelog diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..67dd364 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,22 @@ +# Drafts release notes from merged PRs when you create a release. +# Install: add a Release Drafter config (see below), then create a release on GitHub; +# this workflow will update the draft with categorized PRs. +name: Release Drafter + +on: + push: + branches: [main, master] + workflow_dispatch: + +permissions: + contents: read + pull-requests: write + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - name: Draft Release + uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index faf792d..b82a19a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ 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) +[![Java 21](https://img.shields.io/badge/Java-21-ED8B00?logo=openjdk)](https://openjdk.org/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) + +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/jakubbbdev/terminal-ui) ## Requirements @@ -21,18 +25,6 @@ Run tests: ./gradlew test ``` -Demo (non-interactive): - -```bash -./gradlew run -``` - -Interactive demo (best run in a real terminal): - -```bash -./gradlew runDemo2 -``` - ## Usage (excerpt) ```java diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..71a77b7 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,11 @@ +# Security + +## Reporting a vulnerability + +If you find a security issue, please report it responsibly: + +1. **Do not** open a public issue. +2. Email the maintainers or report via [GitHub Security Advisories](https://github.com/jakubbbdev/terminal-ui/security/advisories/new) (if enabled). +3. Give a clear description and steps to reproduce; we’ll respond as soon as we can. + +Thank you for helping keep this project safe. diff --git a/src/main/java/dev/jakub/terminal/interactive/Confirm.java b/src/main/java/dev/jakub/terminal/interactive/Confirm.java index 57b9144..844936c 100644 --- a/src/main/java/dev/jakub/terminal/interactive/Confirm.java +++ b/src/main/java/dev/jakub/terminal/interactive/Confirm.java @@ -72,7 +72,7 @@ public final class Confirm { } /** - * Uses the given scanner for one line. Use when sharing one scanner (e.g. demo). + * Uses the given scanner for one line. Use when sharing one scanner (e.g. interactive app). */ public boolean ask(Scanner sharedScanner) { if (sharedScanner == null) return ask(); diff --git a/src/main/java/dev/jakub/terminal/interactive/Prompt.java b/src/main/java/dev/jakub/terminal/interactive/Prompt.java index 134eec8..58e06ab 100644 --- a/src/main/java/dev/jakub/terminal/interactive/Prompt.java +++ b/src/main/java/dev/jakub/terminal/interactive/Prompt.java @@ -64,7 +64,7 @@ public final class Prompt { /** * Prompts and returns the next line from the given scanner. Use this when - * sharing one scanner (e.g. in a demo) so input blocks correctly. + * sharing one scanner (e.g. in an interactive app) so input blocks correctly. */ public String ask(Scanner sharedScanner) { if (sharedScanner == null) return ask();