|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +This repository is a Swift Package (`Package.swift`) with one library and one CLI target: |
| 5 | +- `Sources/VideoHash/`: core library code. |
| 6 | +- `Sources/VideoHash/Models/`: shared types (`HashResult`, `HashError`, `HashConfiguration`). |
| 7 | +- `Sources/VideoHash/OSHash/` and `Sources/VideoHash/PHash/`: hash algorithm implementations. |
| 8 | +- `Sources/VideoHash/Utilities/`: logging helpers. |
| 9 | +- `Sources/TestHash/main.swift`: executable target for local manual checks. |
| 10 | +- `Tests/VideoHashTests/`: automated tests (currently OSHash-focused). |
| 11 | +- `.build/`: local build artifacts (do not edit or commit). |
| 12 | + |
| 13 | +## Build, Test, and Development Commands |
| 14 | +Run from repository root: |
| 15 | +- `swift build`: compile all targets in debug mode. |
| 16 | +- `swift test`: run the test suite. |
| 17 | +- `swift run test-hash /absolute/path/to/video.mp4`: run both hashes against a real video file. |
| 18 | +- `swift package resolve`: refresh dependency resolution when package versions change. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Swift 6.2+ and strict concurrency are enabled; prefer `async/await`, `Sendable`, and actors for shared mutable state. |
| 22 | +- Use 4-space indentation and keep one top-level type per file. |
| 23 | +- Type names use `UpperCamelCase`; methods/properties use `lowerCamelCase`. |
| 24 | +- Organize new code by feature folder (`Models`, `OSHash`, `PHash`, `Utilities`) rather than by file type. |
| 25 | +- Keep public APIs documented with concise doc comments. |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Tests use Swift Testing (`import Testing`) with `@Suite` and `@Test`. |
| 29 | +- Name tests by behavior, e.g. `testHashFormat`, `testDeterministic`. |
| 30 | +- Prefer deterministic test data and temporary files; always clean up with `defer`. |
| 31 | +- Add tests for success paths, error handling, and edge constraints (file size, invalid paths, malformed input). |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +Local git metadata is not present in this package snapshot, so no repository-specific commit history could be inferred. Use this baseline: |
| 35 | +- Commit style: imperative, concise subject (<=72 chars), e.g. `Add validation for short OSHash inputs`. |
| 36 | +- Keep commits scoped to one logical change. |
| 37 | +- PRs should include: purpose, behavior changes, test evidence (`swift test` output), and sample CLI usage when relevant. |
0 commit comments