Documentation
¶
Index ¶
- Variables
- func ExtractFrontmatterAndBody(tpl string) (string, string)
- func GetTemplate(docType string) (string, bool)
- func GetTemplateFuncMap() template.FuncMap
- func ListEmbeddedGuidelines() ([]string, error)
- func ListEmbeddedTemplates() ([]string, error)
- func LoadEmbeddedGuideline(docType string) (string, bool)
- func LoadEmbeddedTemplate(docType string) (string, bool)
- func LoadGuideline(root, docType string) (string, bool)
- func LoadTemplate(root, docType string) (string, bool)
- func PrintSchema(w io.Writer, v any, format string) error
- func RenderTemplateBody(body string, doc *models.Document) string
- func RenderVerbTemplate(verbPathCandidates [][]string, root string, settings map[string]interface{}, ...) bool
- type CommonTemplateData
Constants ¶
This section is empty.
Variables ¶
var TemplateContent = map[string]string{
"index": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: index
Intent: short-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Overview
<!-- Provide a brief overview of the ticket, its goals, and current status -->
## Key Links
- **Related Files**: See frontmatter RelatedFiles field
- **External Sources**: See frontmatter ExternalSources field
## Status
Current status: **{{STATUS}}**
## Topics
{{TOPICS_LIST}}
## Tasks
See [tasks.md](./tasks.md) for the current task list.
## Changelog
See [changelog.md](./changelog.md) for recent changes and decisions.
## Structure
- design/ - Architecture and design documents
- reference/ - Prompt packs, API contracts, context summaries
- playbooks/ - Command sequences and test procedures
- scripts/ - Temporary code and tooling
- various/ - Working notes and research
- archive/ - Deprecated or reference-only artifacts
`,
"design-doc": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: design-doc
Intent: long-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Executive Summary
<!-- Provide a high-level overview of the design proposal -->
## Problem Statement
<!-- Describe the problem this design addresses -->
## Proposed Solution
<!-- Describe the proposed solution in detail -->
## Design Decisions
<!-- Document key design decisions and rationale -->
## Alternatives Considered
<!-- List alternative approaches that were considered and why they were rejected -->
## Implementation Plan
<!-- Outline the steps to implement this design -->
## Open Questions
<!-- List any unresolved questions or concerns -->
## References
<!-- Link to related documents, RFCs, or external resources -->
`,
"reference": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: reference
Intent: long-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Goal
<!-- What is the purpose of this reference document? -->
## Context
<!-- Provide background context needed to use this reference -->
## Quick Reference
<!-- Provide copy/paste-ready content, API contracts, or quick-look tables -->
## Usage Examples
<!-- Show how to use this reference in practice -->
## Related
<!-- Link to related documents or resources -->
`,
"working-note": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: working-note
Intent: short-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Summary
<!-- Brief summary for LLM ingestion -->
## Notes
<!-- Free-form notes, meeting summaries, or research findings -->
## Decisions
<!-- Any decisions made during this working session -->
## Next Steps
<!-- Actions or follow-ups -->
`,
"tutorial": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: tutorial
Intent: long-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Overview
<!-- What will readers learn in this tutorial? -->
## Prerequisites
<!-- What knowledge or setup is required? -->
## Step-by-Step Guide
### Step 1: Setup
<!-- First step -->
### Step 2: Implementation
<!-- Next steps -->
## Verification
<!-- How to verify the tutorial was completed successfully -->
## Troubleshooting
<!-- Common issues and solutions -->
## Related Resources
<!-- Links to related documentation or examples -->
`,
"playbook": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: playbook
Intent: short-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Purpose
<!-- What does this playbook accomplish? -->
## Environment Assumptions
<!-- What environment or setup is required? -->
## Commands
<!-- List of commands to execute -->
` + "```bash" + `
# Command sequence
` + "```" + `
## Exit Criteria
<!-- What indicates success or completion? -->
## Notes
<!-- Additional context or warnings -->
`,
"code-review": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: code-review
Intent: long-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Summary
<!-- One-paragraph summary of the review scope and outcome -->
## Context
<!-- PRs, branches, or features reviewed; link to tickets and references -->
## Files Reviewed
<!-- Bullet list of key files; add rationale in RelatedFiles notes when possible -->
## Findings
- Strengths:
- Issues / Risks:
## Decisions & Follow-ups
- Decisions:
- Action Items:
## References
<!-- Links to PRs, commits, docs, or external resources -->
`,
"task-list": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: task-list
Intent: short-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Tasks
- [ ] Task 1
- [ ] Task 2
- [ ] Task 3
## Completed
- [x] Example completed task
## Notes
<!-- Additional context or blockers -->
`,
"log": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: log
Intent: short-term
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
<!-- Log entries in reverse chronological order (newest first) -->
## {{DATE}} - Entry Title
<!-- Log entry content -->
## {{DATE}} - Entry Title
<!-- Previous log entry -->
`,
"script": `---
Title: {{TITLE}}
Ticket: {{TICKET}}
Status: draft
Topics:
{{TOPICS}}
DocType: script
Intent: throwaway
Owners:
{{OWNERS}}
RelatedFiles: []
ExternalSources: []
Summary: >
{{SUMMARY}}
LastUpdated: {{DATE}}
---
# {{TITLE}}
## Purpose
<!-- What does this script do? -->
## Usage
` + "```bash" + `
# Usage example
` + "```" + `
## Implementation
<!-- Describe the script implementation or link to executable file -->
## Notes
<!-- Additional context or warnings -->
`,
}
TemplateContent holds template content for different document types
Functions ¶
func ExtractFrontmatterAndBody ¶
extractFrontmatterAndBody splits a template into (frontmatter, body) using adrg/frontmatter library. If no frontmatter is found, returns ("", template). For templates with placeholders ({{TITLE}}, etc.), falls back to manual parsing since the library can't parse invalid YAML.
func GetTemplate ¶
GetTemplate returns the template content for a given doc type
func GetTemplateFuncMap ¶
GetTemplateFuncMap returns a safe, minimal FuncMap for template rendering
func ListEmbeddedGuidelines ¶ added in v0.0.7
ListEmbeddedGuidelines returns all guideline doc types available in embedded FS
func ListEmbeddedTemplates ¶ added in v0.0.7
ListEmbeddedTemplates returns all template doc types available in embedded FS
func LoadEmbeddedGuideline ¶ added in v0.0.7
LoadEmbeddedGuideline loads a guideline from the embedded filesystem
func LoadEmbeddedTemplate ¶ added in v0.0.7
LoadEmbeddedTemplate loads a template from the embedded filesystem
func LoadGuideline ¶ added in v0.0.7
LoadGuideline loads a guideline from filesystem only (for user customization) Note: Embedded guidelines are ONLY used for scaffolding via docmgr init, NOT in runtime resolution If no guideline is found, callers should handle gracefully (no guideline shown)
func LoadTemplate ¶
LoadTemplate loads a template from filesystem only (for user customization) Note: Embedded templates are ONLY used for scaffolding via docmgr init, NOT in runtime resolution If no template is found, callers should create a minimal document with just frontmatter
func PrintSchema ¶
PrintSchema renders a simple schema describing the structure of v. Supported formats: "json" (default), "yaml".
func RenderTemplateBody ¶
renderTemplateBody replaces placeholders in the template body based on the document values
func RenderVerbTemplate ¶
func RenderVerbTemplate( verbPathCandidates [][]string, root string, settings map[string]interface{}, data interface{}, ) bool
RenderVerbTemplate renders a postfix template for a verb if it exists. verbPathCandidates is a list of possible verb paths to try (e.g., ["doc", "list"] or ["list", "docs"]). Returns true if a template was found and rendered, false otherwise. Errors are printed to stderr and are non-fatal.
Types ¶
type CommonTemplateData ¶
type CommonTemplateData struct {
Verbs []string // Full verb path, e.g., ["docmgr", "doc", "list"]
Root string // Absolute docs root used
Now time.Time // Rendering timestamp
Settings map[string]interface{} // Parsed layer values relevant to the verb
}
CommonTemplateData is the common envelope available to all verb templates