diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7a55529 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*.{md,json,yml,yaml,py}] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +trim_trailing_whitespace = true + +[*.{json,yml,yaml}] +indent_size = 2 + +[*.py] +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes index a61672f..c29622d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,9 @@ *.cs text eol=lf diff=csharp *.md text eol=lf *.json text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.py text eol=lf *.shader text eol=lf *.cginc text eol=lf *.hlsl text eol=lf diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b75eb49 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @Moffefe diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..7398782 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,36 @@ +name: Bug report +description: Report a problem in the game, source code or documentation. +body: + - type: markdown + attributes: + value: | + Check existing issues first. For sensitive reports, follow the [security policy](https://github.com/Moffefe/Path-Machines/blob/main/SECURITY.md). + - type: dropdown + id: area + attributes: + label: Area + options: + - Game behavior + - Source code + - Documentation + validations: + required: true + - type: textarea + id: problem + attributes: + label: What happened? + description: Describe the actual and expected behavior. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Steps or affected files + description: Include reproduction steps or the relevant file and line. Screenshots can help. + validations: + required: true + - type: input + id: version + attributes: + label: Version or commit + description: Include the game version or source commit, if known. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..c43b5a7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Security reporting + url: https://github.com/Moffefe/Path-Machines/blob/main/SECURITY.md + about: Read the policy before reporting a sensitive issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..47ad491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,17 @@ +name: Feature request +description: Suggest an improvement to the game or repository. +body: + - type: textarea + id: problem + attributes: + label: What would this improve? + description: Describe the problem or use case. + validations: + required: true + - type: textarea + id: suggestion + attributes: + label: Suggested change + description: Explain the desired behavior. Add examples or alternatives if useful. + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ad27804 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +## Change + +Describe the problem and the resulting behavior. Link a related issue if applicable. + +## Verification + +Describe the checks you ran and any remaining limitations. + +- [ ] Repository checks pass: `python .github/scripts/check_repository.py`. +- [ ] The change contains no unauthorized third-party material or private data. +- [ ] Source changes include an updated manifest, or this PR only changes documentation/tooling. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bfe0902 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 2 diff --git a/.github/scripts/check_repository.py b/.github/scripts/check_repository.py new file mode 100644 index 0000000..53b6bcf --- /dev/null +++ b/.github/scripts/check_repository.py @@ -0,0 +1,87 @@ +"""Check the published source snapshot and inline local Markdown links.""" + +import hashlib +import json +from pathlib import Path, PurePosixPath +import re +import sys +from urllib.parse import unquote, urlsplit + + +ROOT = Path(__file__).resolve().parents[2] + + +def check_sources(root): + errors = [] + try: + manifest = json.loads((root / "Docs/source-manifest.json").read_text(encoding="utf-8")) + entries = manifest["files"] + if not isinstance(entries, list): + raise ValueError("files must be a list") + if manifest["source_file_count"] != len(entries): + errors.append("Source manifest file count does not match its entries.") + listed = set() + for entry in entries: + name = entry["path"] + relative = PurePosixPath(name) + if (not name.startswith("Source/Assets/") or ".." in relative.parts + or "\\" in name or relative.as_posix() != name): + errors.append(f"Invalid source path: {name}") + continue + if name in listed: + errors.append(f"Duplicate source entry: {name}") + listed.add(name) + source = root / name + if not source.resolve().is_relative_to(root): + errors.append(f"Source path escapes the repository: {name}") + elif not source.is_file(): + errors.append(f"Missing source file: {name}") + elif hashlib.sha256(source.read_bytes()).hexdigest() != entry["sha256"]: + errors.append(f"Source hash mismatch: {name}") + actual = { + file.relative_to(root).as_posix() + for file in (root / "Source/Assets").rglob("*") if file.is_file() + } + for name in sorted(actual - listed): + errors.append(f"Source file missing from manifest: {name}") + except (OSError, ValueError, KeyError, TypeError) as error: + errors.append(f"Invalid source manifest: {error}") + return errors + + +def check_links(root): + errors = [] + # The repository uses inline Markdown links; remote URLs and anchors are excluded. + link_pattern = re.compile(r"!?\[[^\]\n]*\]\((<[^>]+>|[^\s)]+)(?:\s+\"[^\"]*\")?\)") + for document in sorted(root.rglob("*.md")): + if any(part in {".git", ".venv", "node_modules"} for part in document.relative_to(root).parts): + continue + contents = document.read_text(encoding="utf-8") + contents = re.sub(r"```.*?```", "", contents, flags=re.DOTALL) + for match in link_pattern.finditer(contents): + target = match.group(1).strip("<>") + url = urlsplit(target) + if url.scheme or url.netloc or not url.path: + continue + destination = (document.parent / unquote(url.path)).resolve() + name = document.relative_to(root).as_posix() + if not destination.is_relative_to(root): + errors.append(f"Link escapes the repository in {name}: {target}") + elif not destination.exists(): + errors.append(f"Broken local link in {name}: {target}") + return errors + + +def main(): + errors = check_sources(ROOT) + check_links(ROOT) + if errors: + print("Repository checks failed:", file=sys.stderr) + for error in errors: + print(f"- {error}", file=sys.stderr) + return 1 + print("Source manifest and local Markdown links are valid.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.github/workflows/repository-checks.yml b/.github/workflows/repository-checks.yml new file mode 100644 index 0000000..6b84c85 --- /dev/null +++ b/.github/workflows/repository-checks.yml @@ -0,0 +1,28 @@ +name: Repository checks + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: repository-checks-${{ github.ref }} + cancel-in-progress: true + +jobs: + repository-checks: + name: Source integrity and documentation + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Verify source manifest and local links + run: python3 .github/scripts/check_repository.py diff --git a/.gitignore b/.gitignore index d1715e2..50b90e0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ Desktop.ini .idea/ *.user *.tmp +__pycache__/ +*.py[cod] +.venv/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..40484cc --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,9 @@ +# Code of conduct + +Be respectful and keep discussions focused on Path Machines. + +- Give constructive feedback about the work, not personal attacks. +- Do not post harassment, discrimination, threats, spam or another person's private information. +- Respect different experience levels and communicate in good faith. + +The maintainer may edit or remove inappropriate content, close discussions or restrict participation. Use GitHub's **Report content** option to report abuse without repeating sensitive material publicly. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b8641d1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +Bug reports, ideas and small, focused pull requests are welcome. Search existing issues before opening a new one; discuss larger changes first. + +- For bugs, include the affected file or screen, expected behavior and steps to reproduce. Add a commit or game version when available. +- Keep pull requests focused and describe how you checked the change. +- Include only material you have permission to submit. Do not add third-party assets, libraries, save files or credentials. + +This repository contains original source code and screenshots, not a runnable Unity project. Gameplay changes need validation in the complete development project before acceptance. + +From the repository root, run with Python 3.9 or newer: + +```sh +python .github/scripts/check_repository.py +``` + +The check verifies source hashes and local documentation links; it does not build or test the game. When updating a source snapshot, refresh the paths, SHA-256 hashes, file count and revision in [source-manifest.json](Docs/source-manifest.json). + +See the [code of conduct](CODE_OF_CONDUCT.md), [security policy](SECURITY.md) and [license](LICENSE). Public availability does not grant an open-source license. diff --git a/README.md b/README.md index d9ae6fe..0a1b7f5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ **A procedural 3D runner built with Unity and C#.** +[![Repository checks](https://github.com/Moffefe/Path-Machines/actions/workflows/repository-checks.yml/badge.svg?branch=main)](https://github.com/Moffefe/Path-Machines/actions/workflows/repository-checks.yml) + Guide a customizable machine through gardens, basements and living rooms. Avoid obstacles, collect resources and unlock new machines and accessories. **Unity 2023.2.15f1 · C# · Windows x86_64 · Mouse, keyboard and gamepad** @@ -52,4 +54,4 @@ Built-in Render Pipeline, Addressables, Input System, Localization, uGUI/TextMes Developed by [Moffefe](https://github.com/Moffefe). The game is in active development. -[Credits](CREDITS.md) · [License](LICENSE) +[Contributing](CONTRIBUTING.md) · [Credits](CREDITS.md) · [License](LICENSE) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..58efba1 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,9 @@ +# Security + +Security fixes are considered for the current source snapshot on `main`. This repository does not distribute game binaries or maintain separate supported release branches. + +Do not post exploit details, credentials, personal data or private save files in public issues. + +If **Report a vulnerability** is available under the repository's **Security > Advisories** tab, use it to submit a private report. Otherwise, open an issue titled **Private security contact requested**, without technical details, and wait for the maintainer to arrange a private channel before sharing them. + +Ordinary gameplay bugs and documentation errors can use the bug report template.