pack

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNewQuery added in v0.0.2

func GenerateNewQuery(cli *codeql.CLI, args GenerateArgs) error

GenerateNewQuery creates a new CodeQL query with scaffolding. It checks whether a pack with the same full name already exists via ListPacks unless args.Overwrite is true; in that case it returns an error.

Types

type GenerateArgs added in v0.0.2

type GenerateArgs struct {
	Base            string
	QueryName       string
	Lang            string
	Pack            string
	Scope           string
	QueryKind       string
	CreateQueryPack bool
	CreateTests     bool
	Overwrite       bool
	UseBundle       bool
}

GenerateArgs holds all arguments for the pack generate new-query command.

type Pack

type Pack struct {
	YmlPath string
	Config  QlpackConfig
	Deps    []*Pack
}

Pack is a resolved CodeQL pack.

func ListPacks

func ListPacks(cli *codeql.CLI, dir string) ([]*Pack, error)

ListPacks runs `codeql pack ls --format=json <dir>` and returns all packs found.

func (*Pack) CachePath

func (p *Pack) CachePath() string

CachePath returns the path to the .cache/ directory.

func (*Pack) CopyTo

func (p *Pack) CopyTo(destRoot string) (*Pack, error)

func (*Pack) CustomizationsPath

func (p *Pack) CustomizationsPath() string

CustomizationsPath returns the expected path for Customizations.qll.

func (*Pack) DepsPath

func (p *Pack) DepsPath() string

DepsPath returns the path to the .codeql/ installed-dependencies directory.

func (*Pack) Dir

func (p *Pack) Dir() string

Dir returns the directory containing qlpack.yml.

func (*Pack) IsCustomizable

func (p *Pack) IsCustomizable() bool

IsCustomizable returns true if Customizations.qll already exists in the pack dir.

func (*Pack) IsTestPack

func (p *Pack) IsTestPack() bool

IsTestPack returns true if the pack is a test pack, identified by either having an extractor field set or being located under a test/ directory.

func (*Pack) LockFilePath

func (p *Pack) LockFilePath() string

LockFilePath returns the path to codeql-pack.lock.yml.

func (*Pack) SaveConfig

func (p *Pack) SaveConfig(updates map[string]interface{}) error

SaveConfig writes the in-memory qlpack.yml back to disk, preserving existing fields not tracked by QlpackConfig.

type PackKind

type PackKind int

PackKind classifies a CodeQL pack.

const (
	QueryPack         PackKind = iota
	LibraryPack       PackKind = iota
	CustomizationPack PackKind = iota
)

type QlpackConfig

type QlpackConfig struct {
	Name         string            `yaml:"name"`
	Version      string            `yaml:"version"`
	Library      bool              `yaml:"library"`
	Dependencies map[string]string `yaml:"dependencies"`
	Extractor    string            `yaml:"extractor"`
}

QlpackConfig holds the fields from qlpack.yml that qlt cares about.

func (*QlpackConfig) FullName

func (c *QlpackConfig) FullName() string

func (*QlpackConfig) HasExtractor

func (c *QlpackConfig) HasExtractor() bool

HasExtractor returns true if the pack has an extractor field set.

func (*QlpackConfig) ModuleName

func (c *QlpackConfig) ModuleName() string

ModuleName converts "foo/cpp-customizations" → "foo.cpp_customizations" for use in QL import statements.

func (*QlpackConfig) PackName

func (c *QlpackConfig) PackName() string

PackName returns the name part after the scope.

func (*QlpackConfig) Scope

func (c *QlpackConfig) Scope() string

Scope returns the scope part of the pack name (before "/").

Jump to

Keyboard shortcuts

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