pawn-project

module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT

README

pawn-project

pawn-project gives PawnKit tools one answer to a basic question: which project does this Pawn file belong to, and how is that project built?

It finds the workspace, reads pawn.json or pawn.yaml, loads pawn.lock, resolves include paths, and selects the requested build and runtime profile. The formatter, linter, language server, test runner, and CLI all use the same result.

Use it in Go

go get github.com/pawnkit/pawn-project
package main

import (
	"fmt"

	"github.com/pawnkit/pawnkit-core/source"

	"github.com/pawnkit/pawn-project/fsx"
	"github.com/pawnkit/pawn-project/project"
)

func main() {
	reg := source.NewRegistry()

	p, err := project.Load(reg, fsx.OS{}, "/path/to/gamemodes/main.pwn", project.Options{})
	if err != nil {
		panic(err)
	}

	fmt.Println("root:", p.Root())
	fmt.Println("profile:", p.Selection().ProfileID)
	fmt.Println("entry:", p.Paths().Entry)

	for _, d := range p.Diagnostics() {
		fmt.Printf("[%s] %s: %s\n", d.Severity, d.Code, d.Message)
	}
}

The loader accepts a project directory or a file inside one. It returns diagnostics for project problems instead of failing at the first bad field. Environment failures, such as an unreadable manifest, are returned as errors.

See examples/basic for a runnable example.

Manifest compatibility

pawn-project reads sampctl-compatible pawn.json and pawn.yaml files. PawnKit settings live under the optional pawnkit object, so a project does not need to choose between the two tools.

The exact field support and current limitations are listed in docs/compatibility.md.

Status

The module is pre-1.0 and requires Go 1.26 or later. Breaking API changes are recorded in CHANGELOG.md.

Documentation

License

MIT

Directories

Path Synopsis
Package doctor runs safe project and environment checks.
Package doctor runs safe project and environment checks.
examples
basic command
Command basic demonstrates loading an in-memory Pawn project.
Command basic demonstrates loading an in-memory Pawn project.
Package fingerprint computes stable project cache keys.
Package fingerprint computes stable project cache keys.
Package fsx provides filesystem interfaces and test implementations.
Package fsx provides filesystem interfaces and test implementations.
Package include resolves Pawn include directives.
Package include resolves Pawn include directives.
Package lockfile loads and validates pawn.lock files.
Package lockfile loads and validates pawn.lock files.
Package manifest loads and validates pawn.json and pawn.yaml files.
Package manifest loads and validates pawn.json and pawn.yaml files.
Package paths resolves manifest paths within a project root.
Package paths resolves manifest paths within a project root.
Package pathutil handles platform-independent project paths.
Package pathutil handles platform-independent project paths.
Package profile selects a manifest's profile, build, and runtime.
Package profile selects a manifest's profile, build, and runtime.
Package project loads a complete, immutable Pawn project view.
Package project loads a complete, immutable Pawn project view.
Package toolchain resolves, verifies, and caches Pawn compilers.
Package toolchain resolves, verifies, and caches Pawn compilers.
Package toolconfig loads and merges per-tool configuration.
Package toolconfig loads and merges per-tool configuration.
Package workspace finds Pawn project roots.
Package workspace finds Pawn project roots.

Jump to

Keyboard shortcuts

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