Skip to content

feat(doc): add document management (model, schema v4, renderers, CLI)#22

Open
erikreinert wants to merge 7 commits into
mainfrom
feature/docs
Open

feat(doc): add document management (model, schema v4, renderers, CLI)#22
erikreinert wants to merge 7 commits into
mainfrom
feature/docs

Conversation

@erikreinert
Copy link
Copy Markdown
Member

@erikreinert erikreinert commented Jun 5, 2026

Summary

Adds first-class document support to docket — a new doc entity alongside issues, with its own model, persistence, renderers, and a full set of CLI subcommands.

What's included

  • Model & schema (007cc8b): new doc model and a v4 schema migration adding documents, doc comments, and doc links tables.
  • Renderers & scaffold (6577cb0): document renderers (internal/render/doc.go) and the doc command scaffold.
  • CLI subcommands (f112f53): doc create, edit, delete, list, show, comment (add/list), and link.

Changes

  • internal/model/doc model + tests
  • internal/db/ — docs, doc comments, doc links persistence + v4 schema migration + tests
  • internal/render/ — document renderers + tests
  • internal/cli/doc command group and subcommands

24 files changed, ~4.6k insertions.

Test plan

  • go test ./... passes (new tests cover model, db, and render layers)
  • docket doc create / list / show / edit / delete round-trip
  • docket doc comment add / comment list
  • docket doc link add
  • Existing v3 → v4 schema migration applies cleanly

Introduces the doc primitive (docs, doc_revisions, doc_comments,
doc_issue_links, proposal_docs) behind a v4 migration with the
defensive rewind guard. Also extends ClearAllData to include doc
tables plus the previously-omitted proposals/votes/proposal_issues so
`import --replace` no longer silently leaves rows behind, and tolerates
missing tables for older schemas.
@erikreinert erikreinert self-assigned this Jun 5, 2026
Add model.DocRef {id,type,title,status} and Issue.Docs (serialized in
issueJSON); db.HydrateDocs batch hydrator (no N+1) mirroring HydrateFiles;
a 'Linked Docs' section in issue show (styled + plain, omitted when empty)
and docs[] in issue show --json; docs hydration in next --json with the
human table unchanged. Reverses the one-way doc<->issue link so an agent
reading an issue discovers its design docs without a second lookup.

Includes incidental gofmt normalization of a few unrelated files.

Closes DKT-14, DKT-15.
- doc show: linked issues as rich IssueRef {id,kind,title,status} (DKT-21)
- issue show: reverse-lookup linked proposals + rich section (DKT-10)
- plan --json / issue list --json: surface per-issue files+docs (DKT-16, DKT-17)
- fix redundant HydrateFiles double-hydration in plan (DKT-16)

Refs DKT-10, DKT-16, DKT-17, DKT-21
Surface reverse-link proposal/doc references so the relationship is parseable from both ends (DKT-19 / DOC-2):

- issue show --json now emits linked_proposals (id-list, proposal_id ASC, empty -> []), byte-identical to doc show (DKT-22)
- vote show now emits linked_docs in JSON and a "Linked Docs" render section in both styled and plain output (DKT-23)

Also includes a ListIssues sort adjustment in internal/db/issues.go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant