stack

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package stack is a deterministic project tech-stack detector. It produces a StackFacts fact sheet from the repo on disk — language byte percentages plus frameworks/CLIs/databases/infra/CI parsed from manifests and config files — so `memcode stack` and /overview consume FACTS rather than inferring the stack from commit text or subsystem names (which hallucinates).

Detection runs behind the StackDetector interface. LocalStackDetector is native, fast, dependency-free (the only path today). An APIStackDetector — heavier server-side classification — can slot in behind the same interface later.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Brief

func Brief(f StackFacts) string

Brief is the stack as an indented block for embedding under an /overview "Stack" header — the same canonical facts as `memcode stack`, no outer labels.

func FactSheet

func FactSheet(f StackFacts) string

FactSheet is the compact, deterministic block injected into /overview so the model RENDERS the stack from facts instead of inferring it. One line per group.

func Render

func Render(f StackFacts) string

Render formats StackFacts for `memcode stack` — repo shape + a language bar + a grouped detected-stack table. Plain text.

func RepoLine

func RepoLine(r RepoFacts) string

RepoLine summarizes the repository shape in one line: "git · monorepo (4 modules) · pnpm workspaces, Turborepo". Empty if nothing detected.

Types

type LanguageStat

type LanguageStat struct {
	Name  string  `json:"name"`
	Bytes int64   `json:"bytes"`
	Pct   float64 `json:"pct"`
}

LanguageStat is one language's share of the codebase, by bytes.

type LocalStackDetector

type LocalStackDetector struct{}

LocalStackDetector is the native, offline, dependency-free path.

func (LocalStackDetector) Detect

type RepoFacts

type RepoFacts struct {
	VCS       string   `json:"vcs,omitempty"`       // "git"
	Monorepo  bool     `json:"monorepo"`            // multiple modules or a workspace file
	Modules   int      `json:"modules"`             // count of manifest modules found
	Workspace []string `json:"workspace,omitempty"` // Turborepo, pnpm workspaces, Go workspace, …
}

RepoFacts describes the repository shape — VCS, whether it's a monorepo, and any workspace/build orchestrators — all from files on disk.

type StackDetector

type StackDetector interface {
	Detect(ctx context.Context, root string) (StackFacts, error)
}

StackDetector produces a StackFacts for a repo root.

type StackFacts

type StackFacts struct {
	Repo       RepoFacts      `json:"repo"`
	Languages  []LanguageStat `json:"languages"`
	Runtimes   []TechFact     `json:"runtimes"`
	Frameworks []TechFact     `json:"frameworks"`
	CLIs       []TechFact     `json:"clis"`
	Databases  []TechFact     `json:"databases"`
	Infra      []TechFact     `json:"infra"`
	CI         []TechFact     `json:"ci"`
}

StackFacts is the deterministic fact sheet. Every claim is backed by Evidence.

type TechFact

type TechFact struct {
	Name       string   `json:"name"`
	Category   string   `json:"category"`   // runtime|framework|cli|database|infra|ci
	Confidence string   `json:"confidence"` // high (manifest-declared) | medium (inferred)
	Evidence   []string `json:"evidence"`   // files the claim is grounded in
}

TechFact is a detected technology with the file(s) that prove it.

Jump to

Keyboard shortcuts

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