packages

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright 2026 Retail Cortex

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package packages works with a workspace's assets as packages (spec_065 PK-10 to PK-16): adds them from elsewhere (an organization's registry, GitHub, a folder) with a lockfile, verifies them against it, checks them, and compiles them into one manifest, Castor's too, for loaders outside Blitz.

Index

Constants

View Source
const (
	Verified = "verified"
	Modified = "modified"
	Missing  = "missing"
)

The verification statuses.

Variables

View Source
var ErrNotFetched = errors.New("these aren't fetched by Blitz itself: use Castor's cstr for castor://, mod:// and maven:// packages, or a github://, file:// or blitz:// address")

ErrNotFetched is a package Blitz doesn't fetch itself (castor://, mod://, maven://): Castor's cstr does.

View Source
var ErrTaken = errors.New("the workspace has its own of that name: --force replaces it")

ErrTaken is an asset of the name the workspace has that didn't come from a package (or came from another): --force replaces it.

View Source
var Kinds = []string{"agent", "skill", "workflow", "rule", "guardrail", "eval"}

Kinds are every kind of asset, in the order they're listed.

Functions

func Add

func Add(ctx context.Context, root, uri string, o Options) ([]agentpkg.LockEntry, error)

Add adds the package at uri to root (PK-12): its assets written where Blitz reads them, each recorded in the lockfile with where it came from, the version and its digest. It says what it added.

func Compile

func Compile(root string, castor bool) ([]string, error)

Compile writes root's assets into one manifest (PK-13): root/ agents_manifest.json, each asset with its files, digest, version and source (from the lockfile, else its file), and, with castor, Castor's skills_manifest.json beside it for Castor's loaders (its skills: name, description, instructions, path, source URI and digest). It says the files it wrote.

func Description

func Description(kind, text string) string

Description is an asset's description: its front matter's (a workflow's top-level).

func Root

func Root(workspace string) string

Root is a workspace's assets folder.

func Warnings

func Warnings(kind, name string, files map[string]string) []string

Warnings are what's worth fixing in an asset that can still be read (PK-14): no description; a relative link to a file it hasn't.

Types

type Check

type Check func(path string, data []byte) (checked bool, problems []string)

Check is how Validate checks a file as Blitz reads it (the engine's parsers, pkg/catalog, which the service has and the CLI doesn't): whether it checks that file at all, and what's wrong with it.

type Finding

type Finding struct {
	Key      string   `json:"asset"`
	Problems []string `json:"problems,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

Finding is what Validate found in one asset: problems keep it from being one (Blitz refuses it as it reads it); warnings are worth fixing.

func Validate

func Validate(root string, check Check) []Finding

Validate checks every asset under root (PK-14, Castor's audit): each file check reads (a skill's scripts and references are its own, not read one by one), and what's worth fixing: no description, a relative link to a file the asset hasn't. The assets that can't be read are problems too.

type Options

type Options struct {
	Kind        string
	Force       bool
	Registry    Registry
	GitHubBase  string
	GitHubToken string
	HTTP        *http.Client
}

Options are how Add adds: Kind says what a bare file is (an agent, a rule …) when its folder doesn't; Force replaces an asset of the name that didn't come from a package; Registry fetches blitz:// ones; GitHub is GitHub's archive address (codeload.github.com) and its token.

type Registry

type Registry interface {
	Fetch(ctx context.Context, host, kind, name, rng string) (version string, files map[string]string, err error)
}

Registry is an organization's registry, for blitz:// packages (the service's spec_016 RG-10): the version a range resolves to, and its files.

type Result

type Result struct {
	Key      string `json:"asset"`
	URI      string `json:"uri"`
	Status   string `json:"status"`
	Expected string `json:"expected_sha256"`
	Actual   string `json:"actual_sha256,omitempty"`
}

Result is one locked asset's verification (PK-15): verified (its files are as added), modified (they changed since) or missing.

func Verify

func Verify(root string) ([]Result, error)

Verify checks each asset root's lockfile holds against its files now.

Jump to

Keyboard shortcuts

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