Repository navigation
Contributing
OnlyXianzo edited this page Jun 10, 2026
·
1 revision
Thanks for your interest in contributing to TrueStream. This guide explains the process, code style, commit conventions, and architecture rules you'll need to follow.
- Fork the repository on GitHub.
- Create a feature branch from
main. - Make your changes following the code style and guidelines below.
- Verify that your changes pass all checks.
- Submit a pull request targeting
main.
- Follow Effective Dart guidelines and the settings in
analysis_options.yaml. - Use Riverpod for shared state. Never use
setState()for state shared across widgets. UseConsumerWidgetorConsumerStatefulWidgetwith providers. - Body text uses Instrument Sans via
GoogleFonts.instrumentSans(). Mono text for speeds, URLs, and format codes usesTheme.of(context).textTheme.mono, which provides Iosevka Charon Mono through theTrueStreamTextStylesextension. - All colors must reference DESIGN.md tokens through
TrueStreamColors. Never hardcode hex values. - Use
constconstructors where possible. Avoid mutable state in widgets. - Aim for 48x48 minimum touch targets for interactive elements.
- Add semantic labels using the
Semanticswidget for screen reader support. - Run
flutter analyzebefore committing. It must pass with zero errors.
- Follow PEP 8 formatting standards.
- Use the
YoutubeDLclass API from yt-dlp. Never callsubprocess.run()with the yt-dlp binary. - Run all blocking operations in
threading.Threadwith a cancel event. - Use structured JSON for Flutter communication. Don't use
print()statements for machine-readable output. - Keep functions focused on a single responsibility. Each module in
engine/truestream_engine/owns one concern. - Use
set_paths()to inject all binary paths. Never hardcode paths. - Run
pytest engine/tests/ -vbefore committing. All tests must pass.
Use the conventional commit format:
type: scope: description in present tense
Types are init for scaffold, feat for a new feature or screen, fix, chore for config or deps, docs, style for formatting with no logic change, refactor, test, and perf.
Scope is optional but recommended. For example, you might use a task ID like P4-003.
One logical change per commit. Never bundle unrelated changes in a single commit. Each commit diff should be reviewable in under two minutes.
- main is stable and always deployable.
-
Feature branches branch from
mainand should be named by task, for examplefeat/sponsorblock-settingsorfix/cancel-race. - Squash merge into
mainwhen the pull request is approved.
Always run these before committing:
# Flutter static analysis
flutter analyze
# Flutter widget and unit tests
flutter test
# Python engine tests
pytest engine/tests/ -vThe CI pipeline in .github/workflows/verify.yml enforces all three on every push and pull request.
-
Flutter tests: Write widget tests for screens using
WidgetTester. Mock providers withProviderScopeoverrides. Place tests intest/. -
Python tests: Write pytest functions for each module in
engine/tests/test_<module>.py. Use plainassertstatements. One test class per module.
- Make sure your branch is up to date with
main. - Run the full test suite:
flutter analyze,flutter test, andpytest engine/tests/ -v. - Fill out the pull request template. Include motivation, description, and verification steps.
- Mark which platforms you tested on: Android, Windows, or Linux.
- A maintainer reviews your changes. Address feedback before merging.
- Squash commits if the reviewer requests it.
-
yt-dlp:
YoutubeDLclass API only. Never usesubprocess.run()with the yt-dlp binary. -
Downloads: Always run in
threading.Threadwith a cancel event. Never block the main thread. -
State: Use Riverpod with
ConsumerWidget,Notifier, orAsyncNotifier. Never usesetState()for shared state. -
Fonts: Body text uses
GoogleFonts.instrumentSans(). Mono text usesTheme.of(context).textTheme.monofor Iosevka Charon Mono. Never use system fonts. -
Colors: Always use DESIGN.md tokens through
TrueStreamColors. Never use hex literals. -
Paths: Never hardcode paths. All binary paths are injected through
set_paths(). -
Format options: Never use both
merge_output_formatandremux_videoat the same time in yt-dlp options. -
Layout structure: Screens go in
lib/features/<feature>/screens/. Providers go inlib/providers/. Theme and engine bridge code go inlib/core/.
-
Create the screen file at
lib/features/<feature>/screens/<name>_screen.dart. ExtendConsumerWidgetorConsumerStatefulWidgetif you need local state like text controllers. Use thesuper.keypattern. -
Add a provider (if needed) at
lib/providers/<name>_provider.dart. ExtendStateNotifier<State>orAsyncNotifier<State>for shared state. Expose the provider as a globalfinal. -
Wire navigation using
Navigator.of(context).push(MaterialPageRoute(...))for simple navigation. For bottom-nav screens, add the route inlib/features/shell/screens/app_shell.dart. -
Update the app entry point only if the screen is a top-level route like onboarding. Add it in
lib/main.dart. -
Add semantic labels for accessibility using the
Semanticswidget. -
Write a widget test in
test/covering the screen's basic rendering and interactions.
-
Create the module at
engine/truestream_engine/<module>.py. Import from sibling modules where needed, for examplefrom truestream_engine.paths import .... Keep one responsibility per module. -
Add tests at
engine/tests/test_<module>.py. Write pytest functions with plainassertstatements. Cover normal cases, edge cases, and error paths. -
Wire into the IPC dispatch in
engine/truestream_engine/__main__.py. Add anelif method == "<namespace>/<action>"branch that calls your function. Return a JSON-serializable dict and include"success": True/Falsefor error reporting. -
Update the public API in
engine/truestream_engine/__init__.pyif the function should be accessible from the package level. -
Run tests with
pytest engine/tests/ -vand verify that everything passes.