Skip to Content
agore-skill
Reference

Architecture

The package map of the repository and the data flow through the CLI.

Repository layout

agore-skill
  • cmd/agore-skillentry point
    • main.go
  • internalthe nine packages of the CLI
  • docsthe Fumadocs documentation site
  • scriptscoverage, e2e and act helper scripts
  • .githubworkflows, act environment, dependabot, templates
  • mise.tomlpinned toolchain and task definitions
  • .goreleaser.yamlthe CLI binary release configuration

Entry point

cmd/agore-skill/main.go is the only main package. It wires an App (the process dependency surface) into the cobra command tree and hands it to charmbracelet/fang for execution and styling. Any returned error becomes exit code 1; otherwise 0. main_test.go covers the wiring.

Package map

internal
  • clisix cobra commands + the App dependency surface
  • configagore.yaml model, defaults, loader, validation
  • workspaceskill discovery and git change filtering
  • skillSKILL.md parser + embedded scaffold templates
  • filefilterthe shared file funnel: hidden paths, dist/, .gitignore, exclude globs
  • inspecttoken estimation, the L1/L2/L3 analysis, reference reachability and version state
  • lintten deterministic rules and the Diagnostic type
  • releasetag parsing, bundling, changelog, GitHub publisher
  • uilipgloss theme and terminal renderers

Dependency direction is one-way: cli imports the domain packages and ui; no domain package imports cli or ui. filefilter is a leaf package imported by inspect and release.

Data flow through a command

Taking agore-skill inspect --changed as the example:

  1. Command dispatch (cli/root.go) — cobra parses flags (--config, --verbose, --changed, targets).
  2. Config load (config) — agore.yaml or the built-in defaults; unknown top-level sub-domains are tolerated. The exclusion list comes from skill.exclude (a legacy skill.release.exclude value is promoted at load time; both are merged when both are set).
  3. Discovery (workspace) — the configured path patterns expand to directories that directly contain SKILL.md; the root skill sorts first. --changed then filters via App.ChangedFiles, which merges git diff --name-only <base>...HEAD with git status --porcelain (staged, unstaged and untracked paths; renames count as their destination), so uncommitted local edits are picked up immediately.
  4. Skill parsing (skill) — each target directory's SKILL.md becomes a Skill (frontmatter, body, extracted local references; ./-prefixed mentions and trailing punctuation are handled, and unknown frontmatter fields are collected for SPEC-001).
  5. Analysis (inspect) — the shared file funnel (filefilter) decides what is scanned (dotfiles and dot-directories at any depth, the root dist/, agore.yaml, .gitignore rules, then the exclude globs); token estimation builds the L1/L2/L3 report; reference reachability is a breadth-first walk of the references/ Markdown graph (multi-hop mentions are not orphans, missing reachable files are broken_refs); binary files (a NUL byte in the first 512 bytes) report zero tokens; the report also carries latest_version and unreleased_commits from the skill's newest tag.
  6. Rendering (ui) — the lipgloss panel per skill (with the [unreleased] / [v1.2.0] / [v1.2.0 · +N unreleased] version badge), or --json output straight from the report structs.

The other commands follow the same skeleton with their own middle steps: lint runs the rule engine (lint) on parsed skills — its file universe is the funnel-filtered report the analysis produced; release resolves the tag (--tag, then GITHUB_REF_TYPE/GITHUB_REF_NAME, then release tags pointing at HEAD, then release.ParseReleaseTag to name the skill and version), gates on lint, bundles (release.BuildBundle, filtered by the same funnel), and optionally publishes (release GitHub publisher through App.PublishGitHub).

Cross-cutting invariants

  • Determinism — same input, same output: sorted discovery, pinned archive timestamps, pure token estimator.
  • Offline-first — no network except the GitHub publisher in a real release.
  • SKILL.md is read-only — no code path writes into a skill directory.
  • Injection — every effect is an App field; fakes replace it in tests (see Testability and injection).

On this page