X Tutup
Skip to content

feat: Add "sprint create" subcommand#894

Open
CyrilRoelandteNovance wants to merge 1 commit intoankitpokhrel:mainfrom
CyrilRoelandteNovance:sprint-create
Open

feat: Add "sprint create" subcommand#894
CyrilRoelandteNovance wants to merge 1 commit intoankitpokhrel:mainfrom
CyrilRoelandteNovance:sprint-create

Conversation

@CyrilRoelandteNovance
Copy link

This commit adds a "jira sprint create" subcommand.

ichoosetoaccept pushed a commit to ichoosetoaccept/jira-cli that referenced this pull request Nov 28, 2025
Cherry-picked from CyrilRoelandteNovance/sprint-create
Original author: CyrilRoelandteNovance
@ankitpokhrel ankitpokhrel requested a review from Copilot January 20, 2026 18:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds functionality to create sprints in JIRA via a new jira sprint create subcommand. Users can specify sprint details like name, start/end dates, and goals through command-line flags or interactive prompts.

Changes:

  • Adds API client methods for creating sprints with request/response types
  • Implements sprint create CLI subcommand with flag parsing and interactive prompts
  • Adds test coverage for the new sprint creation API endpoint

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pkg/jira/sprint.go Adds CreateSprint method with request/response types for sprint creation API
pkg/jira/sprint_test.go Adds test case for the CreateSprint functionality
pkg/jira/testdata/sprint-create.json Provides test data for sprint creation response
internal/cmd/sprint/sprint.go Registers the new create subcommand
internal/cmd/sprint/create/create.go Implements the sprint creation command with CLI flags and interactive prompts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

assert.Error(t, &ErrUnexpectedResponse{}, err)
}

func TestCreateSrpint(t *testing.T) {
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Srpint' to 'Sprint' in function name.

Suggested change
func TestCreateSrpint(t *testing.T) {
func TestCreateSprint(t *testing.T) {

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


func TestCreateSrpint(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.NotNilf(t, r.Method, "invalid request method")
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion logic is incorrect. r.Method is a string and will never be nil. This assertion serves no purpose and should be removed.

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be true, but then this should also be modified (in a different commit) in TestEndSprint.

StartDate: "2025-09-01T13:37:00.000+00:00",
EndDate: "2025-09-08T13:37:00.000+00:00",
Goal: "Testing jira-cli",
OriginBoardID: 42,
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test data inconsistency: OriginBoardID is set to 42 in the request but the expected response has OriginBoardID: 5 (line 452). This mismatch will cause the test to fail.

Suggested change
OriginBoardID: 42,
OriginBoardID: 5,

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests were not failing but were indeed confusing, I fixed this by setting OriginBoardID to 42 and the sprint ID to 1337.

Comment on lines +298 to +304
defer func() { _ = res.Body.Close() }()
if err != nil {
return nil, err
}
if res == nil {
return nil, ErrEmptyResponse
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defer statement is placed before the nil check for res (line 302). If res is nil, this will cause a panic. Move the defer statement after verifying that res is not nil.

Suggested change
defer func() { _ = res.Body.Close() }()
if err != nil {
return nil, err
}
if res == nil {
return nil, ErrEmptyResponse
}
if err != nil {
return nil, err
}
if res == nil {
return nil, ErrEmptyResponse
}
defer func() { _ = res.Body.Close() }()

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if params.StartDate == "" {
qs = append(qs, &survey.Question{
Name: "StartDate",
Prompt: &survey.Input{Message: "Start date (YYYY-MM-DDD)"},
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'YYYY-MM-DDD' to 'YYYY-MM-DD' in date format message.

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if params.EndDate == "" {
qs = append(qs, &survey.Question{
Name: "EndDate",
Prompt: &survey.Input{Message: "End date (YYYY-MM-DDD)"},
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'YYYY-MM-DDD' to 'YYYY-MM-DD' in date format message.

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@Steap
Copy link

Steap commented Jan 21, 2026

Most comments from Copilot have been addressed, except the one regarding NotNilf, since I'm not sure Copilot is right about that. I'm not an experienced Go developer, so I have no idea about this myself and have just trusted the code in TestEndSprint :)

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.

3 participants

X Tutup