commit 357a72114b60c1c80f74dded886b21f9330781b3 Author: Daniel Samson Date: Fri Oct 30 12:18:31 2026 +0000 chore: initial project setup for newzy Add repository scaffolding: .gitignore, README, CONTRIBUTING, MIT license, pre-push quality hook, and documentation covering branching, file conventions, and commit style. Establish the main/develop branching strategy. This is project setup only; no application functionality is included. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbb5ffa --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Dependencies +node_modules/ +.pnp +.pnp.js + +# Environment files (never commit secrets) +.env +.env.* +!.env.example + +# Logs +logs/ +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Builds / output +dist/ +build/ +out/ +.next/ +.nuxt/ +.cache/ +.parcel-cache/ + +# Testing +coverage/ +.nyc_output/ + +# Editor / IDE +.idea/ +.vscode/ +*.swp +*.swo +*~ +.project +.classpath +.settings/ + +# OS files +.DS_Store +Thumbs.db + +# Local data / uploads +data/ +uploads/ +*.sqlite +*.db diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9920d31 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,104 @@ +# Contributing to newzy + +Thank you for considering a contribution to **newzy**! This document explains how to set up your environment, follow the branching model, write commits, and submit changes. + +## Ground Rules + +Please keep the following in mind: + +- Be respectful and constructive in all discussions and code reviews. +- Keep pull requests focused — one logical change per PR. +- Never commit secrets, credentials, or `.env` files (see `.gitignore`). +- Follow the existing style and conventions before introducing new patterns. + +## Prerequisites + +- [Git](https://git-scm.com/downloads) with your name and email configured: + + ```bash + git config --global user.name "Your Name" + git config --global user.email "you@example.com" + ``` + +- A Gitea account with access to the repository. + +## Git Hooks + +newzy ships versioned hooks in `hooks/` (currently a `pre-push` hook that runs code quality checks). Enable them once per clone: + +```bash +git config core.hooksPath hooks +``` + +The hook is a no-op until the application toolchain (`package.json`) exists; afterwards it runs the `lint` and `test` scripts (if defined) before every push. + +## Branching Model + +newzy uses a `main` / `develop` branching model: + +| Branch | Purpose | Lives in | +| ------------ | -------------------------------------------------- | --------------- | +| `main` | Production-ready code, stable releases | Always | +| `develop` | Integration branch for feature development | Always | +| `feature/*` | New features and enhancements (from `develop`) | Temporary | +| `bugfix/*` | Bug fixes (from `develop`) | Temporary | +| `hotfix/*` | Critical fixes for production (from `main`) | Temporary | + +Detailed rules, including merge and rebase workflows, are in [docs/branching.md](docs/branching.md). + +### Typical Workflow + +```bash +# Start from an up-to-date develop +git checkout develop +git pull --rebase origin develop + +# Create your feature branch +git checkout -b feature/reader-view + +# Commit your work (Conventional Commits) +git commit -m "feat: add reader view for articles" + +# Rebase onto latest develop to keep history linear +git rebase develop + +# Push and open a pull request against develop +git push -u origin feature/reader-view +``` + +## Commit Conventions + +All commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/) format: + +``` +: + +[optional body] + +[optional footer] +``` + +Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. + +See [docs/commits.md](docs/commits.md) for the full format and sample messages. + +## Code Review Process + +1. Push your branch and open a pull request against `develop` (or `main` for `hotfix/*`). +2. Ensure the CI checks pass. +3. At least one approval is required before merging. +4. Squash-merge feature branches into `develop` so each feature is a single commit. +5. Delete the source branch after merging. + +## Releasing + +Releases are cut from `main` only. The release process is: + +1. Merge `develop` into `main` (merge commit, no squash). +2. Tag the commit: `git tag -a v1.0.0 -m "Release v1.0.0"`. +3. Push the tag: `git push origin v1.0.0`. +4. Back-merge `main` into `develop` to keep them in sync. + +## Questions? + +Open a discussion or issue in the repository if anything in this document is unclear or outdated. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..97ef2f9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Daniel Samson + +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..aac887b --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# newzy + +> A news web application. + +**newzy** is a news web application for discovering, reading, and managing news content. This repository is currently in its initial setup stage — application functionality will be implemented in upcoming milestones. + +## Project Status + +| Milestone | Description | Status | +| --------- | ------------------------- | -------- | +| M1 | Git project setup | Done | +| M2+ | News application features | Planned | + +See [milestones/](milestones/) for milestone prompts and progress tracking. + +## Requirements + +No runtime requirements yet (setup-only milestone). When development of the application begins, the toolchain will be documented here. + +## Getting Started + +```bash +# 1. Clone the repository +git clone https://gitea.samson.media/daniel/newz-qwen-27b.git newzy +cd newzy + +# 2. Check out the integration branch +git checkout develop + +# 3. Create your feature branch +git checkout -b feature/ + +# 4. Commit your changes (Conventional Commits) +git add . +git commit -m "feat: add " + +# 5. Push and open a pull request +git push -u origin feature/ +``` + +Full contribution guidelines, including branching, merging, and rebase workflows, are in [CONTRIBUTING.md](CONTRIBUTING.md). + +## Documentation + +- [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute +- [docs/branching.md](docs/branching.md) — branch strategy, merge and rebase workflows +- [docs/conventions.md](docs/conventions.md) — file structure and naming conventions +- [docs/commits.md](docs/commits.md) — commit message format and examples + +## License + +[MIT](LICENSE) © 2026 Daniel Samson diff --git a/docs/branching.md b/docs/branching.md new file mode 100644 index 0000000..ed91557 --- /dev/null +++ b/docs/branching.md @@ -0,0 +1,89 @@ +# Branching Strategy + +This document describes the branch model, naming conventions, and merge/rebase workflows for **newzy**. + +## Branches + +### Long-lived branches + +| Branch | Purpose | Protected | +| ----------- | -------------------------------------------------------------- | --------- | +| `main` | Production-ready code. Always deployable. Receives releases. | Yes | +| `develop` | Integration branch. All features land here before release. | Yes | + +### Short-lived branches + +| Branch | Created from | Merged into | Used for | +| ------------ | ------------ | ------------ | ------------------------------------------ | +| `feature/*` | `develop` | `develop` | New features and enhancements | +| `bugfix/*` | `develop` | `develop` | Bug fixes not yet in production | +| `hotfix/*` | `main` | `main` | Critical fixes for production (immediate) | + +## Naming Conventions + +- Use lowercase, kebab-case names: `feature/reader-view`, `bugfix/empty-feed-crash`. +- Prefix with the type: `feature/`, `bugfix/`, `hotfix/`. +- Keep the description short (2–4 words) and meaningful. +- Optionally prefix with an issue number: `feature/123-article-search`. + +## Merge and Rebase Workflows + +### Feature development (rebase workflow) + +Keep feature branches linear by rebasing onto the latest `develop` before pushing a pull request: + +```bash +git checkout feature/reader-view +git fetch origin +git rebase origin/develop +# resolve any conflicts, then: +git rebase --continue +git push --force-with-lease origin feature/reader-view +``` + +> **Rule:** only force-push branches that are still under active development and have not been merged. Never force-push `main` or `develop`. + +### Merging into `develop` + +- Feature and bugfix branches are **squash-merged** into `develop` so each feature appears as one clean commit. +- The commit message of the squash commit must be a valid Conventional Commit (see [commits.md](commits.md)). + +### Merging into `main` (releases) + +- `develop` is merged into `main` with a **merge commit** (no squash, no rebase) to preserve the full feature history. +- Example: `git merge --no-ff develop -m "release: cut v1.0.0"`. +- Tag the resulting commit and push the tag. + +### Hotfixes + +```bash +# 1. Branch off main +git checkout main +git pull --rebase origin main +git checkout -b hotfix/feed-outage + +# 2. Fix, commit, and PR against main (merge commit) + +# 3. After merging into main, back-merge into develop +git checkout develop +git pull --rebase origin develop +git merge --no-ff hotfix/feed-outage -m "merge: backport hotfix/feed-outage" +git push origin develop +``` + +## Conflict Resolution Strategy + +1. **Rebase early, rebase often.** Resolve conflicts against `develop` at least once per day while a feature branch is active. +2. Resolve conflicts on the feature branch (the rebasing side), never by rewriting `main`/`develop`. +3. After resolving, run `git rebase --continue` and verify the app still works before pushing. +4. If a conflict cannot be resolved confidently, stop and ask for help in the pull request — do not guess. +5. The person who created the conflict (usually the branch doing the rebasing) owns the resolution. + +## Do / Don't + +| Do | Don't | +| --------------------------------------------------------- | ------------------------------------------------ | +| Branch off `develop` (or `main` for hotfixes) | Commit directly to `main` or `develop` | +| Keep branches short-lived (ideally under a week) | Push broken/unfinished code to protected branches| +| Use `--force-with-lease` when force-pushing | Force-push shared or merged branches | +| Rebase before opening a PR | Merge `develop` back into your feature branch | diff --git a/docs/commits.md b/docs/commits.md new file mode 100644 index 0000000..088cfd7 --- /dev/null +++ b/docs/commits.md @@ -0,0 +1,81 @@ +# Commit Conventions + +All commits in **newzy** follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This keeps history readable, machine-parseable, and enables automated changelogs. + +## Format + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +- **type** (required): what kind of change this is. +- **scope** (optional): area of the codebase affected, e.g. `reader`, `feed`, `ci`. +- **description** (required): imperative mood, no trailing period, ≤ 72 chars. +- **body** (optional): wrap at 72 chars; explain *what* and *why*, not *how*. +- **footer** (optional): `BREAKING CHANGE:` annotations and issue references (`Closes #12`). + +## Allowed Types + +| Type | Use for | +| ---------- | ---------------------------------------------------------- | +| `feat` | New functionality for the user | +| `fix` | Bug fixes | +| `docs` | Documentation changes only | +| `style` | Formatting, whitespace — no behavior change | +| `refactor` | Code change that neither fixes a bug nor adds a feature | +| `perf` | Performance improvements | +| `test` | Adding or correcting tests | +| `build` | Build system, dependencies, bundlers | +| `ci` | CI configuration and pipeline changes | +| `chore` | Maintenance, tooling, housekeeping (e.g. repo setup) | +| `revert` | Reverting a previous commit | + +## Sample Commit Messages + +```text +chore: initial project setup for newzy + +Add repository scaffolding: .gitignore, README, CONTRIBUTING, +MIT license, and documentation for branching, conventions, +and commit style. Establish main/develop branch strategy. +``` + +```text +feat(feed): add paginated news feed + +Fetches the first page of articles on load and appends +additional pages on scroll. Closes #12. +``` + +```text +fix(reader): handle missing article images + +Falls back to a placeholder image when an article has no +media, fixing a blank card in the feed. +``` + +```text +docs: clarify rebase rules for feature branches +``` + +```text +ci: add lint and test checks to pull request workflow +``` + +```text +chore(deps): bump vite from 5.2.0 to 5.4.1 + +BREAKING CHANGE: Node 18 is no longer supported; requires Node 20+. +``` + +## Rules of Thumb + +1. One logical change per commit — split unrelated changes. +2. Write the description in imperative mood: `add`, `fix`, `remove` (not `added`, `fixes`, `removed`). +3. Reference issues in the footer: `Closes #12`, `Refs #34`. +4. Mark breaking changes with a `BREAKING CHANGE:` footer. +5. When in doubt about the type, `chore` is the safe fallback for housekeeping. diff --git a/docs/conventions.md b/docs/conventions.md new file mode 100644 index 0000000..d861813 --- /dev/null +++ b/docs/conventions.md @@ -0,0 +1,57 @@ +# File Structure & Naming Conventions + +This document defines the repository layout and naming rules for **newzy**. + +## Project Structure + +``` +project-root/ +├── .gitignore # Files/directories excluded from version control +├── LICENSE # MIT License +├── README.md # Project overview and quick start +├── CONTRIBUTING.md # Contribution guidelines +├── docs/ # Project documentation +│ ├── branching.md # Branch strategy, merge and rebase workflows +│ ├── conventions.md # This file: structure and naming rules +│ └── commits.md # Commit message format and examples +├── hooks/ # Versioned Git hooks (install via core.hooksPath) +│ └── pre-push # Code quality checks before pushing +└── milestones/ # Milestone prompts and progress tracking + └── m1-setup-git-project-prompt.md +``` + +As the application grows, the following top-level entries are expected (added in later milestones): + +``` +project-root/ +├── src/ # Application source code +│ ├── components/ # Reusable UI components +│ ├── pages/ # Route-level views +│ ├── lib/ # Shared utilities and helpers +│ └── ... +├── public/ # Static assets (images, favicon, ...) +├── tests/ # Test suites (if not colocated) +├── scripts/ # Build/automation scripts +└── .env.example # Documented, example environment variables +``` + +## Naming Conventions + +| Item | Convention | Examples | +| ---------------- | ----------------- | --------------------------------- | +| Directories | kebab-case, plural where they hold many items | `components/`, `news-articles/` | +| Source files | kebab-case | `article-card.tsx`, `feed-service.ts` | +| Test files | `*.test.*` or `*.spec.*` suffix, colocated with source or in `tests/` | `article-card.test.tsx` | +| Docs | kebab-case `.md` | `branching.md`, `commits.md` | +| Branches | `type/kebab-name` | `feature/reader-view` | +| Tags | `vX.Y.Z` (SemVer) | `v1.0.0` | +| Env files | `.env.example` committed, `.env*` ignored | `.env.example` | + +## General Rules + +1. **One file, one concern.** If a file grows beyond ~300 lines, consider splitting it. +2. **Colocate** related files (component + its tests + its styles) in the same directory. +3. **No committed secrets.** Secrets belong in `.env` (ignored); `.env.example` documents required variables with placeholder values. +4. **Docs live in `docs/`** unless they are root-level standards (README, CONTRIBUTING, LICENSE). +5. **Milestones live in `milestones/`**, named `m<#>--prompt.md`. +6. Avoid absolute paths and machine-specific settings in committed files. diff --git a/hooks/pre-push b/hooks/pre-push new file mode 100755 index 0000000..138011b --- /dev/null +++ b/hooks/pre-push @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# pre-push — code quality checks before pushing to the remote. +# +# Install (per clone): +# git config core.hooksPath hooks +# +# The hook is a no-op until the application toolchain (package.json) +# exists. When it does, `lint` and `test` scripts are run if defined. + +status=0 + +if [ -f package.json ]; then + if npm run lint --if-present --silent; then + echo "pre-push: lint passed" + else + echo "pre-push: lint FAILED — push aborted" >&2 + status=1 + fi + + if [ "$status" -eq 0 ] && npm run test --if-present --silent; then + echo "pre-push: tests passed" + else + [ "$status" -eq 0 ] && echo "pre-push: tests FAILED — push aborted" >&2 + status=1 + fi +fi + +exit "$status" diff --git a/milestones/m1-setup-git-project-prompt.md b/milestones/m1-setup-git-project-prompt.md new file mode 100644 index 0000000..2e5f4a0 --- /dev/null +++ b/milestones/m1-setup-git-project-prompt.md @@ -0,0 +1,87 @@ +# M1: Setup Git Project Prompt + +## Prompt + +Create a new git repository for a news web application called **newzy**. Follow these steps: + +1. Initialize a new Git repository in the `newzy` project directory +2. Configure `.gitignore` with appropriate exclusions for web applications (node modules, logs, env files, etc.) +3. Set up initial branch structure: + - `main`: Production-ready, stable releases + - `develop`: Integration branch for feature development +4. Create the following initial file structure: + - `docs/` - Project documentation +5. Add `README.md` with project overview and setup instructions +6. Add `CONTRIBUTING.md` with contribution guidelines +7. Add `LICENSE` with MIT license text +8. Commit all initial files with a descriptive commit message following conventional commits format +9. Create the `develop` branch from `main` +10. Push both branches to remote repository + +Remember: This is just project setup. Do NOT implement any news web application functionality yet. + +## Description + +This milestone sets up the foundational git infrastructure for **newzy**, a news web application. The scope is limited to repository initialization and project scaffolding—no actual news functionality will be implemented at this stage. + +**Purpose**: Create a professional, maintainable git repository structure that enables smooth team collaboration from day one. + +**Target Audience**: New contributors, team members, and future developers joining the project. + +**Expected Outcomes**: A fully initialized git repository with proper branching strategy, documentation, and standard files ready for development work. + +## Acceptance Criteria + +- [ ] Git repository is initialized with proper configuration +- [ ] Standard branch strategy is documented (e.g., main, develop, feature/*) +- [ ] File structure and naming conventions are clearly defined +- [ ] LICENSE file with MIT license is included +- [ ] .gitignore file includes relevant exclusions for the project type +- [ ] Initial README.md explains how to get started +- [ ] Sample commit messages demonstrate best practices +- [ ] Documentation covers branching, merging, and rebase workflows + +## Technical Details + +### Project Structure +``` +project-root/ +├── docs/ +│ └── ... # Documentation for the project +├── LICENSE # MIT License +├── README.md +└── CONTRIBUTING.md +``` + +### Branch Strategy +- `main`: Production-ready code, stable releases +- `develop`: Integration branch for feature development +- `feature/*`: New features and enhancements +- `bugfix/*`: Bug fixes from develop +- `hotfix/*`: Critical fixes from main + +### License +MIT License - See LICENSE file in project root + +### Git Configuration Requirements +- Email and name configured on all contributors +- Pre-push hooks for code quality checks +- Merge conflict resolution strategy documented + +## QA Notes + +### Testing Checklist +- [ ] Verify git history is clean and properly formatted +- [ ] Confirm .gitignore excludes all necessary files +- [ ] Test branch creation and switching workflow +- [ ] Validate merge and rebase instructions work correctly +- [ ] Check README examples are accurate +- [ ] Ensure documentation is language-appropriate + +### Known Issues / Limitations +- Any known limitations in the prompt that should be addressed in future iterations + +### Success Metrics +- Time to onboard new contributor (hours) +- Number of merge conflicts after training +- Contribution quality scores