Architecture
The package map of the repository and the data flow through the CLI.
Repository layout
- 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
- 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:
- Command dispatch (
cli/root.go) — cobra parses flags (--config,--verbose,--changed, targets). - Config load (
config) —agore.yamlor the built-in defaults; unknown top-level sub-domains are tolerated. The exclusion list comes fromskill.exclude(a legacyskill.release.excludevalue is promoted at load time; both are merged when both are set). - Discovery (
workspace) — the configured path patterns expand to directories that directly containSKILL.md; the root skill sorts first.--changedthen filters viaApp.ChangedFiles, which mergesgit diff --name-only <base>...HEADwithgit status --porcelain(staged, unstaged and untracked paths; renames count as their destination), so uncommitted local edits are picked up immediately. - Skill parsing (
skill) — each target directory'sSKILL.mdbecomes aSkill(frontmatter, body, extracted local references;./-prefixed mentions and trailing punctuation are handled, and unknown frontmatter fields are collected for SPEC-001). - Analysis (
inspect) — the shared file funnel (filefilter) decides what is scanned (dotfiles and dot-directories at any depth, the rootdist/,agore.yaml,.gitignorerules, then the exclude globs); token estimation builds the L1/L2/L3 report; reference reachability is a breadth-first walk of thereferences/Markdown graph (multi-hop mentions are not orphans, missing reachable files arebroken_refs); binary files (a NUL byte in the first 512 bytes) report zero tokens; the report also carrieslatest_versionandunreleased_commitsfrom the skill's newest tag. - Rendering (
ui) — the lipgloss panel per skill (with the[unreleased]/[v1.2.0]/[v1.2.0 · +N unreleased]version badge), or--jsonoutput 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
Appfield; fakes replace it in tests (see Testability and injection).
Related
- File-by-file package contents: Packages reference
- What each command does: CLI overview