Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .issues/.counter
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15
18
46 changes: 46 additions & 0 deletions .issues/closed/015-make-template-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
id: "015"
assignee: ""
labels: []
created: 2025-11-24T11:30:27.643813+09:00
updated: 2025-11-24T12:14:28.9905+09:00
---

# Make template work

## Description

The `gi create` command is not using the `.issues/template.md` file when creating new issues. New issues are created with minimal content instead of the structured template that includes Description, Requirements, and Success Criteria sections.

## Current Behavior

When running `gi create`, new issues are created with only:
- YAML frontmatter (id, assignee, labels, created, updated)
- A simple title heading
- Empty content

## Expected Behavior

New issues should be created based on `.issues/template.md`, which includes:
- YAML frontmatter (with appropriate fields populated)
- Title heading
- Description section with placeholder text
- Requirements section with example bullet points
- Success Criteria section with checkboxes

## Steps to Reproduce

1. Run `gi create` and enter an issue title
2. Open the newly created issue file
3. Observe that the file does not contain the template sections

## Impact

Users must manually add common sections (Description, Requirements, Success Criteria) to each new issue, reducing productivity and consistency across issues.

## Success Criteria

- [ ] `gi create` command reads `.issues/template.md` when creating new issues
- [ ] Template sections (Description, Requirements, Success Criteria) appear in new issues
- [ ] YAML frontmatter fields are properly populated (id, timestamps, etc.)
- [ ] Title from user input replaces "Issue Title" placeholder in template
23 changes: 23 additions & 0 deletions .issues/closed/016-test-template-functionality.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: "016"
assignee: ""
labels: []
created: 2025-11-24T11:40:26.980336+09:00
updated: 2025-11-24T11:40:41.888813+09:00
---

# Test template functionality

## Description

Describe the issue here...

## Requirements

- Requirement 1
- Requirement 2

## Success Criteria

- [ ] Criterion 1
- [ ] Criterion 2
24 changes: 24 additions & 0 deletions .issues/closed/017-sample-issue-to-show-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
id: "017"
assignee: user1
labels:
- feature
created: 2025-11-24T12:14:42.020428+09:00
updated: 2025-11-24T12:14:51.635438+09:00
---

# Sample issue to show template

## Description

Describe the issue here...

## Requirements

- Requirement 1
- Requirement 2

## Success Criteria

- [ ] Criterion 1
- [ ] Criterion 2
45 changes: 44 additions & 1 deletion pkg/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,59 @@ func GetClosedPath() string {
return filepath.Join(IssuesDir, ClosedDir)
}

// LoadTemplateBody reads the template file and extracts the body content (after title heading)
func LoadTemplateBody() string {
templatePath := filepath.Join(IssuesDir, TemplateFile)

// Read template file
data, err := os.ReadFile(templatePath)
if err != nil {
// If template doesn't exist, return empty body
return ""
}

// Parse the template to extract body
content := string(data)
parts := strings.SplitN(content, "---", 3)
if len(parts) < 3 {
// Invalid template format, return empty
return ""
}

// Get everything after frontmatter
body := strings.TrimSpace(parts[2])

// Skip the title line (first # heading) and get everything after
lines := strings.Split(body, "\n")
for i, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "# ") {
// Return everything after the title line
if i+1 < len(lines) {
return strings.TrimSpace(strings.Join(lines[i+1:], "\n"))
}
return ""
}
}

// If no title found, return the whole body
return body
}

// NewIssue creates a new Issue with default values
func NewIssue(id int, title, assignee string, labels []string) *Issue {
now := time.Now()

// Load template body
templateBody := LoadTemplateBody()

return &Issue{
ID: FormatID(id),
Assignee: assignee,
Labels: labels,
Created: now,
Updated: now,
Title: title,
Body: "",
Body: templateBody,
}
}