From 092299ff33b6aa2265fa4db2c1b1ac672b50aef8 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Tue, 27 Jan 2026 00:10:27 -0800 Subject: [PATCH] feat(config): implement configuration system and contributing guide (#6, #4) --- .gitignore | 3 +- CONTRIBUTING.md | 410 +++++++++++++++++++++++++++++++++++++ config.example.json | 11 + docs/configuration.md | 203 ++++++++++++++++++ scripts/load-config.sh | 69 +++++++ scripts/validate-config.sh | 73 +++++++ 6 files changed, 767 insertions(+), 2 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 config.example.json create mode 100644 docs/configuration.md create mode 100755 scripts/load-config.sh create mode 100755 scripts/validate-config.sh diff --git a/.gitignore b/.gitignore index 88f1b85..0c01580 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ # Local configuration files (contain secrets - do NOT commit) # Developers should copy config.example to config and add their test credentials -config -*.config +config.json !config.example !*.config.example diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6c8f2a7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,410 @@ +# Contributing to Nextcloud Share + +Thank you for your interest in contributing to Nextcloud Share! This document provides guidelines and workflows for contributing to the project. + +--- + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [Getting Started](#getting-started) +- [Git Workflow](#git-workflow) +- [Development Setup](#development-setup) +- [Making Changes](#making-changes) +- [Submitting a Pull Request](#submitting-a-pull-request) +- [Issue Guidelines](#issue-guidelines) +- [Commit Message Guidelines](#commit-message-guidelines) + +--- + +## Code of Conduct + +We expect all contributors to be respectful, inclusive, and professional. Please: + +- Be welcoming to newcomers +- Provide constructive feedback +- Focus on what is best for the community +- Show empathy towards other community members + +--- + +## Getting Started + +1. **Fork the repository** on Gitea (if external contributor) +2. **Clone your fork** locally: + ```bash + git clone https://git.tomusan.com/maj/nextcloud-share.git + cd nextcloud-share + ``` +3. **Add upstream remote** (if forked): + ```bash + git remote add upstream https://git.tomusan.com/maj/nextcloud-share.git + ``` + +--- + +## Git Workflow + +This project uses the **git-flow** branching model. Understanding this workflow is essential for contributing. + +### Branch Structure + +#### `main` - Production Branch +- **Purpose**: Contains production-ready, stable releases only +- **Rules**: + - Never commit directly to `main` + - Only receives merges from `release/*` or `hotfix/*` branches + - Every commit on `main` is tagged with a version number + - Represents the current production state + +#### `develop` - Integration Branch +- **Purpose**: Integration branch where features come together +- **Rules**: + - Default branch for development + - Never commit directly to `develop` + - Receives merges from `feature/*` branches + - Always contains the latest delivered development changes + - Should always be in a working state + +#### `feature/*` - Feature Branches +- **Purpose**: Develop new features or enhancements +- **Naming**: `feature/-` + - Example: `feature/8-webdav-client` +- **Branch from**: `develop` +- **Merge into**: `develop` +- **Lifetime**: Deleted after merge + +**Creating a feature branch**: +```bash +git checkout develop +git pull origin develop +git checkout -b feature/8-webdav-client +``` + +**Merging a feature**: +```bash +git checkout develop +git merge --no-ff feature/8-webdav-client +git push origin develop +git branch -d feature/8-webdav-client +``` + +#### `release/*` - Release Preparation Branches +- **Purpose**: Prepare for a new production release +- **Naming**: `release/v` + - Example: `release/v0.1.0` +- **Branch from**: `develop` +- **Merge into**: `main` AND `develop` +- **Lifetime**: Deleted after merge + +**Creating a release branch**: +```bash +git checkout develop +git checkout -b release/v0.1.0 +# Bump version numbers, update CHANGELOG, etc. +``` + +**Finishing a release**: +```bash +# Merge to main +git checkout main +git merge --no-ff release/v0.1.0 +git tag -a v0.1.0 -m "Release version 0.1.0" +git push origin main --tags + +# Merge back to develop +git checkout develop +git merge --no-ff release/v0.1.0 +git push origin develop + +# Delete release branch +git branch -d release/v0.1.0 +``` + +#### `hotfix/*` - Emergency Fix Branches +- **Purpose**: Quick fixes for critical production bugs +- **Naming**: `hotfix/v-` + - Example: `hotfix/v0.1.1-fix-crash` +- **Branch from**: `main` +- **Merge into**: `main` AND `develop` +- **Lifetime**: Deleted after merge + +**Creating a hotfix**: +```bash +git checkout main +git checkout -b hotfix/v0.1.1-fix-crash +# Make the fix +``` + +**Finishing a hotfix**: +```bash +# Merge to main +git checkout main +git merge --no-ff hotfix/v0.1.1-fix-crash +git tag -a v0.1.1 -m "Hotfix version 0.1.1" +git push origin main --tags + +# Merge to develop +git checkout develop +git merge --no-ff hotfix/v0.1.1-fix-crash +git push origin develop + +# Delete hotfix branch +git branch -d hotfix/v0.1.1-fix-crash +``` + +--- + +## Development Setup + +### Prerequisites + +- **Podman** (preferred) or **Docker** +- **Git** +- **jq** (for config parsing) + +### Configuration + +1. **Copy the example config**: + ```bash + cp config.example.json config.json + ``` + +2. **Edit `config.json`** with your Nextcloud test credentials: + ```json + { + "nextcloud": { + "url": "https://cloud.tomusan.com", + "username": "your-username", + "password": "your-app-password" + } + } + ``` + +3. **Never commit `config.json`** - it's in `.gitignore` + +### Building with Containers + +All builds should be done inside containers to ensure consistency: + +```bash +# Build 3DS app (when available) +podman build -f docker/devkitarm.Dockerfile -t nextcloud-share-3ds . +podman run --rm -v ./:/project:z nextcloud-share-3ds make -C 3ds + +# Build shared library (when available) +podman build -f docker/builder.Dockerfile -t builder . +podman run --rm -v ./:/project:z builder cmake -B build -S shared +podman run --rm -v ./:/project:z builder cmake --build build +``` + +--- + +## Making Changes + +### 1. Find or Create an Issue + +- Check [existing issues](https://git.tomusan.com/maj/nextcloud-share/issues) +- Create a new issue if needed +- Get issue number (e.g., `#42`) + +### 2. Create a Feature Branch + +```bash +git checkout develop +git pull origin develop +git checkout -b feature/42-short-description +``` + +### 3. Make Your Changes + +- Write clean, maintainable code +- Follow existing code style +- Add tests for new functionality +- Update documentation as needed +- Test your changes thoroughly + +### 4. Commit Your Changes + +Follow the [commit message guidelines](#commit-message-guidelines): + +```bash +git add +git commit -m "feat: add WebDAV client implementation (#42)" +``` + +### 5. Keep Your Branch Updated + +```bash +git checkout develop +git pull origin develop +git checkout feature/42-short-description +git rebase develop +``` + +### 6. Push Your Branch + +```bash +git push origin feature/42-short-description +``` + +--- + +## Submitting a Pull Request + +1. **Push your feature branch** to the repository +2. **Open a Pull Request** on Gitea: + - Base: `develop` + - Compare: `feature/42-short-description` +3. **Fill out the PR template**: + - Reference the issue number (e.g., "Closes #42") + - Describe what changed and why + - Add any testing notes +4. **Wait for review**: + - Address any feedback + - Push additional commits if needed + - CI must pass before merge + +### PR Checklist + +- [ ] Branch is up-to-date with `develop` +- [ ] All tests pass locally +- [ ] New tests added for new features +- [ ] Documentation updated +- [ ] Commit messages follow guidelines +- [ ] CI pipeline passes +- [ ] Code has been self-reviewed +- [ ] No sensitive data (passwords, tokens) in commits + +--- + +## Issue Guidelines + +### Creating Issues + +- **Use a clear, descriptive title** +- **Provide context**: What are you trying to do? +- **Include reproduction steps** for bugs +- **Add relevant labels**: `bug`, `feature`, `platform:3ds`, etc. +- **Reference related issues** if applicable + +### Working on Issues + +- **Comment on the issue** before starting work to avoid duplication +- **Update the issue** with progress notes +- **Link commits** to issues using `#` in commit messages +- **Close issues** with "Closes #" or "Fixes #" in PR description + +--- + +## Commit Message Guidelines + +We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. + +### Format + +``` +(): (#) + + + +