cli

package module
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 10 Imported by: 0

README

TPIX CLI

A command-line client for managing Typst packages on the TPIX server. For more information about TPIX and TPIX CLI, please visit TPIX.

Installation

Use the install script to download and install the latest stable version if you are using Linux or MacOS:

curl -fsSL https://tpix.typstify.com/install.sh | bash

You can also download pre-built binaries from the GitHub Releases page.

For developers, use the following command to install tpix-cli:

go install github.com//tpix-cli@latest

Or build from source:

git clone https://github.com/typstify/tpix-cli.git
cd tpix-cli
make install

The binary will be built as tpix and installed in /usr/local/bin/ in Linux and MacOS.

Quick Start

# Login to TPIX server
tpix login

# Search for packages
tpix search "chart"

# Download a package
tpix get @namespace/package-name:1.0.0

# View package info
tpix info @namespace/package-name

Commands

Authentication
tpix login

Login using OAuth 2.0 device flow. Required for uploading packages.

Configuration
# Print cache directory path
tpix cache-path

# Set custom cache directory
tpix cache-path --set /custom/path

# Reset to default cache directory
tpix cache-path --set ""

The cache directory can also be set via the TYPST_PACKAGE_CACHE_PATH environment variable, which takes precedence over the saved config value.

Search & Discovery
# Search packages
tpix search "chart"

# Search in specific namespace
tpix search "chart" -n mynamespace

# Limit results
tpix search "chart" -l 10
Download Packages
# Download latest version (with transitive dependencies)
tpix get @namespace/package-name

# Download specific version
tpix get @namespace/package-name:1.0.0

# Download without fetching dependencies
tpix get @namespace/package-name:1.0.0 --no-deps
Pull Project Dependencies
# Scan current directory for .typ imports and fetch all dependencies
tpix pull

# Preview what would be fetched without downloading
tpix pull --dry-run

tpix pull recursively scans all .typ files in the current directory for #import "@namespace/name:version" statements, then downloads each package along with its transitive dependencies. Already-cached packages are skipped.

Package Info
# View package details
tpix info @namespace/package-name
Local Cache
# List cached packages
tpix list

# Remove cached package
tpix remove @namespace/package-name:1.0.0
Create Package
# Create package from directory
tpix bundle ./my-package

# Specify output file
tpix bundle ./my-package -o my-package.tar.gz

# Exclude files
tpix bundle ./my-package -e ".git" -e "node_modules/" -e "*.test"

The directory must contain a valid typst.toml manifest with required fields:

[package]
name = "mypackage"
version = "1.0.0"
entrypoint = "lib.typ"
authors = ["Your Name"]
license = "MIT"
description = "A sample package"

You can also specify excluded files in the manifest:

[package]
# ... other fields
exclude = [".git", "*.test", "node_modules/"]

For more information on how to create a package, please refer to docs in https://github.com/typst/packages/tree/main/docs.

Upload Package
# Upload to namespace
tpix push my-package.tar.gz mynamespace
Zotero Export
# List accessible Zotero libraries
tpix zotero list

# Create and download an export (interactive mode)
tpix zotero export

# Export to a specific file
tpix zotero export -o references.bib

# Export with specific format
tpix zotero export --format bibtex -o references.bib

# Export from specific library
tpix zotero export --library 12345 -o references.bib

tpix zotero export creates a temporary export, downloads the citations, and automatically cleans up. Use --format to specify output format (default: biblatex).

Version & Updates
# Check current version and updates
tpix version

# Update to latest version
tpix update

Output Format

Package specifications use the format @namespace/name:version:

  • @user/chart - latest version from user's namespace
  • @user/chart:1.0.0 - specific version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundlePackage

func BundlePackage(srcDir string, outputFile string, excludedFiles []string) (string, error)

func CreateZoteroExport

func CreateZoteroExport(name string, namespaceID string, libraryType string, libraryID int64, collectionKey string, format string, reporter ReportFunc) (string, error)

CreateZoteroExport creates an export target on the TPIX server.

func DeleteZoteroExport

func DeleteZoteroExport(exportID string, reporter ReportFunc) error

DeleteZoteroExport deletes an existing Zotero export.

func DownloadPackage

func DownloadPackage(pkgSpec string, cacheDir string, noDeps bool, reporter ReportFunc) (int, error)

DownloadPackage download Typst packages from TPIX server. pkgSpec should follow the pattern: @namespace/name:version. Refer to [parsePkgSpec] to know details. If noDeps is true, it will skip fetching transitive dependencies.

func DownloadProjectDependencies

func DownloadProjectDependencies(projectDir string, cacheDir string, dryRun bool, reporter ReportFunc) error

func FetchZoteroExport

func FetchZoteroExport(exportID string, writer io.Writer) error

FetchZoteroExport fetches the content of a Zotero export.

func GetUserProfile added in v0.8.1

func GetUserProfile() (*api.UserProfile, error)

GetUserProfile queries the user profile from TPIX server.

func ListZoteroLibraries

func ListZoteroLibraries() ([]api.ZoteroLibrary, error)

ListZoteroLibraries returns the list of Zotero libraries accessible to the user.

func ParsePkgSpec

func ParsePkgSpec(pkgSpec string) (namespace, name, version string)

ParsePkgSpec parses a package spec in the format @namespace/name:version Returns namespace, name, and version (version may be empty)

func PollLoginResult added in v0.6.1

func PollLoginResult(deviceCode string, expiresIn int, reporter ReportFunc) (*api.TokenResponse, error)

func PushPackage

func PushPackage(packagePath string, namespace string, reporter ReportFunc) error

func QueryPackage

func QueryPackage(pkgSpec string) (*api.PackageResponse, error)

func SearchPackages

func SearchPackages(namespace string, query string, kind string, category string, sort string, limit int) (*api.SearchResponse, error)

SearchPackages searches Typst packages from TPIX server.

func StartLogin added in v0.6.1

func StartLogin() (*api.DeviceCodeResponse, error)

Types

type ReportFunc

type ReportFunc func(message string)

type ZoteroLibrary

type ZoteroLibrary = api.ZoteroLibrary

ZoteroLibrary represents a Zotero library.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL