Metadata-Version: 2.4
Name: typvend
Version: 0.1.0
Summary: Typst Package Vendoring CLI
License: MIT License
        
        Copyright (c) 2026 Diego Alvarez S.
        
        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.
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: niquests>=3.18.0
Requires-Dist: platformdirs>=4.9
Description-Content-Type: text/markdown

# typvend — Typst Package Vendoring CLI

`typvend` is a lightweight Python CLI utility designed to vendor official Typst packages locally for offline development, sandboxed builds, or containerized production CI/CD workflows.

## Why?

Typst downloads packages on the fly at compile time with no official way to pre-download them.
This can be problematic for offline compilation and read-only production environments (like containers).
The solution is to either run the compilation once to fetch the packages or download them manually.

`typvend` simplifies this, downloading packages to the default Typst cache path or any directory you choose (then point Typst to it via `--package-cache-path`), in two ways:
- **Explicit:** `add <pkg>[@<version>]` — download specific packages by name, with a version or `@latest`.
- **Scan:** recursively find all `@preview/<pkg>:<version>` imports in `.typ` files and vendor them in one go.

## Usage

```bash
# Install and run instantly using uvx / pipx
uvx typvend --help
```

Global options:
- `-o`, `--output DIR` — Custom directory to extract packages (defaults to native OS Typst search path).
- `--namespace NS` — Custom namespace (defaults to `preview`).
- `-f`, `--force` — Re-download package even if it already exists.
- `-v`, `--verbose` — Enable verbose output logs.

### 1. Adding Packages Explicitly

```bash
# Download latest version of fontawesome
uvx typvend add fontawesome

# Download specific versions
uvx typvend add fontawesome@0.5.0 cetz
```

### 2. Scanning Project Directories

Recursively searches a file or directory for package imports and vendors all discovered packages in one command:

```bash
# Scan a templates directory and output packages to typst cache folder
uvx typvend scan ./templates

# Scan and output to a custom directory (e.g. for Docker cache stages)
uvx typvend scan ./templates --output /typst-packages
```
