composer

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package composer implements `sf composer` — compact, TOON-first views over a tree of PHP packages described by composer.json files. It replaces the recurring, token-expensive pattern of `cat`-ing each package's composer.json (plus `git tag` and grepping phpstan.neon) just to learn the shape of a monorepo or a collection of sibling library repos.

sf composer ls [root]      one digest row per package across a tree
sf composer show <pkg>     full metadata for a single package
sf composer check [pkg]    run each package's own quality gate, summarised

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand returns the `composer` group (`sf composer …`).

func Run

func Run(opts Options, w io.Writer) error

Run collects the digest, renders it, and logs the call.

func RunCheck

func RunCheck(opts CheckOptions, w io.Writer) error

RunCheck runs each selected package's own `composer check` gate and renders a compact pass/fail summary instead of the full phpunit/phpstan/cs output.

func RunShow

func RunShow(opts ShowOptions, w io.Writer) error

RunShow resolves a single package, renders its detail, and logs the call.

Types

type CheckOptions

type CheckOptions struct {
	Root   string // tree to scan (default: cwd)
	Target string // optional single package (name suffix or dir basename); empty = all
	Format string
}

CheckOptions controls a `composer check` run.

type CheckResult

type CheckResult struct {
	Name       string `json:"name"`
	Dir        string `json:"dir"`
	OK         bool   `json:"ok"`
	Exit       int    `json:"exit"`
	DurationMs int64  `json:"dur_ms"`
	Fail       string `json:"fail,omitempty"`
}

CheckResult is the outcome of running one package's `check` script.

type Detail

type Detail struct {
	Name       string `json:"name"`
	Dir        string `json:"dir"`
	Version    string `json:"version"`
	Type       string `json:"type"`
	PHP        string `json:"php"`
	PHPStan    string `json:"phpstan"`
	Namespace  string `json:"namespace,omitempty"`
	Scripts    []kv   `json:"scripts,omitempty"`
	Require    []kv   `json:"require,omitempty"`
	RequireDev []kv   `json:"require_dev,omitempty"`
}

Detail is the full single-package view shown by `composer show`.

func CollectOne

func CollectOne(root, target string) (Detail, error)

CollectOne finds the package matching target under root and returns its Detail.

type Options

type Options struct {
	Root   string // tree to scan (default: cwd)
	Format string
}

Options controls a `composer ls` run.

type Pkg

type Pkg struct {
	Name       string   `json:"name"`
	Dir        string   `json:"dir"` // relative to scan root
	Version    string   `json:"version"`
	Type       string   `json:"type"`
	PHP        string   `json:"php"`
	PHPStan    string   `json:"phpstan"`
	Namespace  string   `json:"namespace,omitempty"`
	Scripts    []string `json:"scripts,omitempty"`
	Require    []string `json:"require,omitempty"`
	RequireDev []string `json:"require_dev,omitempty"`
}

Pkg is one package's digest, as shown by `composer ls`.

func Collect

func Collect(root string) ([]Pkg, error)

Collect walks root for composer.json files and returns one Pkg each, sorted by package name (then dir for unnamed packages).

type ShowOptions

type ShowOptions struct {
	Root   string // tree to search (default: cwd)
	Target string // package name, name suffix, dir basename, or path
	Format string
}

ShowOptions controls a `composer show` run.

Jump to

Keyboard shortcuts

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