feat: implement the wiki field in the issue domain

format.md listed `wiki:` among the domain fields, between depends and
origin, and issue.py had never heard of it. The field fell into extra and
rendered with the foreign keys — sorted in after the sync fields, which
the same document forbids one line below the table. Written without
brackets it parsed as a single string, and nothing but a text editor
could set it.

Implemented rather than de-documented: page_ls.py --titles already
prints these titles, so the field was designed and only unwired.
DOMAIN_KEYS and LIST_KEYS learn it, Issue carries it, and issue_new.py
gets a repeatable --wiki flag.

Titles only, as the format says: no path, no sub_url, no lookup. The
tracker has no field for it, so it is never sent and a pull does not
bring it back — format.md now says so.

Closes #32

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
naudachu
2026-08-10 19:55:10 +05:00
parent bf0936526d
commit 9479babfe9
4 changed files with 164 additions and 7 deletions
+12 -5
View File
@@ -25,6 +25,7 @@ domain has. The file name is the id:
assignees: [naudachu]
milestone: v0.2
depends: [migrate-schema]
wiki: [Simple Chains/Ideas/Chain core]
origin: gitea
gitea: owner/repo#42
synced: 2026-08-07T18:40:00Z
@@ -113,8 +114,9 @@ ISSUE_ROOT = store_root()
# Domain-owned metadata, in render order. Foreign keys render after these,
# sorted, so the sync layer can add fields without touching this list.
DOMAIN_KEYS = ["id", "state", "labels", "assignees", "milestone", "depends", "origin"]
LIST_KEYS = {"labels", "assignees", "depends"}
DOMAIN_KEYS = ["id", "state", "labels", "assignees", "milestone", "depends",
"wiki", "origin"]
LIST_KEYS = {"labels", "assignees", "depends", "wiki"}
STATES = ("open", "closed")
# `origin` is "does this issue exist anywhere but here" — a fact about the
@@ -247,8 +249,8 @@ class Issue(object):
"""One unit of work. `extra` holds metadata this layer does not own."""
def __init__(self, id="", title="", body="", state="open", labels=None,
assignees=None, milestone="", depends=None, origin=LOCAL,
extra=None):
assignees=None, milestone="", depends=None, wiki=None,
origin=LOCAL, extra=None):
self.id = id
self.title = title
self.body = body
@@ -257,6 +259,10 @@ class Issue(object):
self.assignees = list(assignees or [])
self.milestone = milestone or ""
self.depends = list(depends or [])
# Page TITLES this work is written up in — names for documents, which
# is why they are domain-owned. What a title resolves to is /tea:page's
# business, and this layer never asks: no path, no URL, no lookup.
self.wiki = list(wiki or [])
self.origin = origin or LOCAL
self.extra = dict(extra or {})
@@ -302,7 +308,7 @@ class Issue(object):
state=meta.get("state") or "open",
labels=lst("labels"), assignees=lst("assignees"),
milestone="" if ms == "none" else ms,
depends=lst("depends"),
depends=lst("depends"), wiki=lst("wiki"),
origin=meta.get("origin") or LOCAL, extra=extra)
def to_text(self):
@@ -314,6 +320,7 @@ class Issue(object):
"assignees": self.assignees,
"milestone": self.milestone or "none",
"depends": self.depends,
"wiki": self.wiki,
"origin": self.origin,
})
body = self.body.strip() or "(no body)"