Proposal: generate the configuration reference from struct comments
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go, json, markdown
- Ambito
- documentation, tooling
Direzione di ricerca
The proposal concerns the option/ Go structs and their doc comments, the hand-written docs/configuration/** pages, docs/schema.json, and the docgen and cmd/internal/generate_docs tooling with the make check_docs target. Before any code, a maintainer must decide whether a pull request in this direction is accepted, since the issue is an open proposal with no reply yet. Done would mean an agreed scope and a generator whose output matches the current reference.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Proposal: generate the configuration reference from struct comments
Hello,
I would like to propose moving the configuration reference to a struct-first model. Before opening a PR I would like to confirm whether this direction is acceptable, because creating a pull request from my fork fails with CreatePullRequest permission errors (403/404).
Background
docs/configuration is currently maintained by hand in parallel with the option/ structs, which causes:
- drift between fields and documentation (new/renamed/removed fields, changed defaults);
- duplicated descriptions of shared fields (
tls,dial,listen,udp_timeout, …) across pages; - hand-written
Structureexamples that go stale; - a second description source in
docs/schema.json; - Chinese pages drifting from English (headings, wording, leftover sections);
- documentation prose stored inside page manifests.
Proposal
Make option/ doc comments the single source of truth and generate the reference from them:
- field descriptions, examples, defaults, enums and deprecation notices live next to the fields;
docgenrendersdocs/configuration/**anddocs/schema.json;- an audit compares generated pages with the legacy baseline line by line, so the migration does not lose text;
make check_docsfails when the generated output is stale;- Chinese is maintained only in a locale catalog (prose, plus
<Struct>.<key>.headingfor localized field headings); - manifests only describe page composition (definitions, expansion, example adjustments), with no prose and no empty placeholder objects.
A small annotation vocabulary is used in comments: @Required, @Since, @Deprecated in <version>:, @Default, @Enum, @See, @Example, @Omit, @Omit: <pages>, admonitions (@note, @warning, …), @Doc <key>: for keys without a field (including variant holder fields), @Override <key>: for embedded-field wording, @shared <slug> and @Tag for shared pages/examples.
Current status
Branch: https://github.com/systemhelper-arm64/sing-box/tree/docs-autogen
Commits:
ab0c3f5d docgen: generate configuration reference from struct comments
bfcefbb9 option: document endpoint pages and adopt metadata markers
885c86ea docgen: generate example blocks, origin links, and marker catalog
7e7e5cde option: backfill documentation comments for every configuration field
722eb572 docgen: struct-first documentation generator
Verification:
go run ./cmd/internal/generate_docs -check→ OK, audit issues: 0make check_docs→ passgo test ./docgen→ pass (embed overrides,@Docplacement, fence-aware twin heading mapping, implicit definitions, reference option types, ACME schema union)go vet ./docgen/ ./option/,gofmt -l→ clean- manifests prose: 0, empty objects: 0
Request
- Is a pull request acceptable for this direction? If pull requests are limited to collaborators, how should the change be submitted?
- Is the proposed scope reasonable (generator + comment backfill + regenerated pages + schema + tests)?
- I can split or reduce the change if the size is a concern (for example, landing the generator first and regenerating pages separately).
If this is not the right place for the discussion, please let me know where to move it.
Thank you!
- Lingua principale
- Go
- Stelle
- 40.4k
- Fork
- 5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SagerNet/sing-box
-
`check` and startup are quadratic in outbound group size since 1.14.4 (duplicate tag check)Forse già presa @Tidehyc l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
database file removal errorsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
Tutte le issue di SagerNet/sing-box
Issue simili
-
good first issue tools
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
Edwin-metcalf/MetCode#76 ·
I maintainer di solito rispondono entro 1 giorno
-
-diff's removed-name budget ignores the names the -ptr pass testedForse già presa @nova-loop l’ha presa oggi. Apertaarea: cli bug good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TMHSDigital/subenum#495 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort:s impact:med raised-by:worker risk:low to:worker
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
medici-finance/assay#8120 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
factory:subtask
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
reportedBy/community
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openchoreo/openchoreo#5751 ·
I maintainer di solito rispondono entro 1 giorno