feat: add README parser with entry extraction and section tree building

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Bisconti
2026-02-27 23:17:50 +01:00
parent 08da394e71
commit f2680c6221
3 changed files with 310 additions and 0 deletions

35
internal/parser/types.go Normal file
View File

@@ -0,0 +1,35 @@
package parser
// Marker represents a status emoji on an entry.
type Marker int
const (
MarkerAbandoned Marker = iota // :skull:
MarkerPaid // :heavy_dollar_sign:
MarkerWIP // :construction:
)
// Entry is a single link entry in the README.
type Entry struct {
Name string
URL string
Description string
Markers []Marker
Line int // 1-based line number in source
Raw string // original line text
}
// Section is a heading with optional entries and child sections.
type Section struct {
Title string
Level int // heading level: 1 = #, 2 = ##, etc.
Entries []Entry
Children []Section
Line int
}
// Document is the parsed representation of the full README.
type Document struct {
Preamble []string // lines before the first section
Sections []Section
}