Add global preview configuration via OnceLock
Add global accessor functions to `uv-preview` following the same pattern
as `uv-flags`. This allows preview features to be checked without
threading `preview: Preview` through function parameters.
- Add `uv_preview::init()` to initialize the global preview once at startup
- Add `uv_preview::get()` to retrieve the current preview configuration
- Add `uv_preview::is_enabled()` to check if a specific feature is enabled
The global is initialized in `crates/uv/src/lib.rs` alongside the
existing `uv_flags::init()` call.
https://claude.ai/code/session_01Gzak8YGk9kpH3Uy9HWypS5
Package by default
This change is more complex than just toggling the switch, as we want to give users something runnable to start with, but also packaged setup.
I haven't updated the tests yet.
**Draft**
| kind | package | template |
|-----------|----------------|----------------------------------------------------------|
| (default) | (default) | `main.py` calling `hello()` + package exposing `hello()` |
| (default) | `--package` | `main.py` calling `hello()` + package exposing `hello()` |
| (default) | `--no-package` | `main.py` with `main()` |
| `--app` | (default) | `main.py` with `main()` |
| `--app` | `--package` | `main.py` calling `hello()` + package exposing `hello()` |
| `--app` | `--no-package` | `main.py` with `main()` |
| `--lib` | (default) | package exposing `hello()` |
| `--lib` | `--package` | package exposing `hello()` |
| `--lib` | `--no-package` | Error: libraries are always packaged |
The default is a mixed layout: There's a package, but also a `main.py`. `--lib` creates only the package, no `main.py`, while `--app` creates only `main.py`. `--package` has no effect - it's the default now - while `--no-package` goes back to the previous default.