CLI and Go API reference
Sunset has a local CLI and a public Go parsing package. The CLI has no network authentication or service endpoint.
For the product-specific guides, see CLI overview, parse and update, Go API overview, and node and tree operations.
CLI commands
| Command | Syntax | Behavior |
|---|---|---|
parse | sunset parse <path> [flags] | Parse a file or directory and generate Markdown. An omitted path means .. |
update | sunset update [path] [flags] | Re-parse changed files using the cache and summary output. |
languages | sunset languages | Print supported language IDs and extensions. |
version | sunset version | Print sunset <version>. |
clean | sunset clean [path] | Remove <path>/.sunset, including cache and output. |
help | sunset help | Print top-level help. --help and -h do the same. |
The root flags --version and -v print the version. A missing or unknown
command prints help; an unknown command exits non-zero.
Parse flags
| Flag | Default | Effect |
|---|---|---|
--output | <path>/.sunset/output | Select the Markdown output directory. |
--detail | summary | Use summary or full; any value other than full selects summary mode. |
--exclude | empty | Comma-separated filename or relative-path glob patterns. |
--concurrency | NumCPU | Maximum concurrent parser work when positive. |
--no-cache | false | Force a full re-parse and do not load or save cache state. |
--max-depth | 0 | Limit full-CST depth; zero means unlimited. |
--quiet | false | Suppress normal progress and result output. |
update accepts --output, --exclude, --concurrency, and --quiet. It
does not accept the parse-only detail, cache, or CST-depth flags.
Generated output
Each file document starts with YAML frontmatter containing file, language,
optional Go package, lines, function/type/import counts, and tags. Summary
sections include signatures and 1-based line ranges; imports include their
source line. The project index records language statistics, totals, generated
time, version, and directory modules.
Go API
Import the public package with the module path declared in go.mod:
import "github.com/enolalabs/sunset/pkg/sunset"
The main functions and types are:
ParseFile(path string, opts ...Option) (*FileResult, error)reads one file, detects its language from the extension, and returns source bytes plus aTreeWrapper.WithLanguage(id string) Optionforces a registered language ID such asgo,javascript,typescript, orpython.Languages() []LanguageInforeturns the registered names, IDs, and extensions.FileResult.Close()releases tree-sitter resources. Call it when finished.FileResult.HasErrors()reports syntax errors while the result is open.TreeWrapper.RootNode(),Walk, andFilterexpose tree traversal.Node.Type,Text,Position,EndPosition,Children,NamedChildren,ChildByFieldName,Parent,IsNamed,IsError,IsMissing, andChildCountinspect nodes.
Node.Position and EndPosition use zero-based rows and columns. This differs
from the generated summary's human-facing line numbers, which are one-based.