Skip to content

feat(jtk): add project management commands#106

Merged
rianjs merged 2 commits intomainfrom
feat/101-project-management-commands
Feb 8, 2026
Merged

feat(jtk): add project management commands#106
rianjs merged 2 commits intomainfrom
feat/101-project-management-commands

Conversation

@rianjs
Copy link
Copy Markdown
Contributor

@rianjs rianjs commented Feb 8, 2026

Summary

  • Add full CRUD project management commands to jtk (list, get, create, update, delete, restore, types)
  • Extends existing api/projects.go with SearchProjects, CreateProject, UpdateProject, DeleteProject, RestoreProject, ListProjectTypes
  • Adds new internal/cmd/projects/ command package with aliases projects, project, proj, p
  • Delete uses confirmation prompt with --force bypass, matching existing issues delete pattern

Test plan

  • Unit tests for all 7 API methods (api/projects_test.go)
  • Command structure tests (Register, flag validation)
  • Command execution tests for list (table, JSON, empty), get, create, delete (force, decline), restore, types
  • Build passes (make build-jtk)
  • All tests pass (go test ./tools/jtk/...)
  • Lint passes (make lint)

Closes #101

Add full CRUD for Jira projects via the REST API v3:
- list: search/list projects with optional query filter
- get: get project details by key or ID
- create: create projects with key, name, type, lead, description
- update: update project metadata (name, description, lead)
- delete: soft-delete to trash with --force flag and confirmation prompt
- restore: restore a project from trash
- types: list available project types

Aliases: projects, project, proj, p

Closes #101
@rianjs
Copy link
Copy Markdown
Contributor Author

rianjs commented Feb 8, 2026

Test Coverage Assessment for PR #106

Summary

This PR adds 7 new API methods and 7 new CLI commands for project management. It includes two test files: api/projects_test.go (343 lines) and internal/cmd/projects/projects_test.go (271 lines). Overall, the coverage is solid and consistent with existing patterns in the codebase. There are a few gaps worth noting, but nothing that blocks merging.

What is well-covered

API layer (api/projects_test.go):

  • All 7 API methods have at least one happy-path test: SearchProjects, GetProject, CreateProject, UpdateProject, DeleteProject, RestoreProject, ListProjectTypes
  • SearchProjects uses table-driven tests with success, empty results, and server error cases
  • GetProject tests success, 404 not found, and empty key validation
  • Empty key guard (ErrProjectKeyRequired) is tested for UpdateProject, DeleteProject, and RestoreProject
  • HTTP method and URL path assertions verify correct API endpoint construction
  • CreateProject test validates the request body is serialized correctly (key, name, type, lead)

Command layer (internal/cmd/projects/projects_test.go):

  • Register test verifies subcommands and aliases
  • runList tested in table, JSON, and empty-result modes
  • runGet tested in table mode with lead display
  • runCreate tested with success output verification
  • runDelete tested for both --force and interactive decline paths
  • runRestore and runTypes both have happy-path tests
  • Flag structure tests for list, get, create, delete commands

Gaps identified (minor, not blocking)

  1. No runUpdate command-level test. The API layer tests UpdateProject, but runUpdate in the command layer has no test at all -- it is the only run* function without one. This is a straightforward function, but for consistency with the rest of the PR, a test would be good.

  2. No JSON output tests for get, create, restore, or types commands. The list command is tested with both table and JSON output, but the other commands only test table output. Since each command has an if opts.Output == "json" branch, those branches are untested at the command level. The issues/get_test.go file in the existing codebase does test JSON output, so the pattern exists.

  3. SearchProjects pagination parameters are not verified in test assertions. The test passes startAt=0, maxResults=50 but the mock handler only checks the query parameter -- it never asserts that startAt and maxResults are set in the URL query string. Since the implementation skips startAt when it is 0 and includes maxResults when > 0, a test with non-zero startAt would exercise that branch.

  4. No test for SearchProjects with non-default pagination. The conditional if startAt > 0 and if maxResults > 0 branches in the API method are never exercised because every test call passes startAt=0. A case with startAt=50 would cover this.

  5. delete interactive confirmation with "y" input is not tested. The decline path ("n") is tested, but the acceptance path where the user types "y" and the API call actually fires is only tested via --force. These are different code paths -- the --force path skips the prompt entirely while the "y" path goes through prompt.Confirm and then calls the API.

  6. CreateProject and UpdateProject API tests do not test server error responses. SearchProjects and GetProject both test error conditions (500, 404), but the write operations only test the happy path. If the Jira API returns a 409 conflict or 400 validation error, these tests would not catch regressions in error handling.

Verdict

The test coverage is adequate for merge and consistent with the existing test patterns in the codebase (e.g., comments_test.go, transitions_test.go, get_test.go). The PR author has clearly followed the established conventions. The gaps above are all minor -- the most notable one is the missing runUpdate command test, which is a straightforward omission. None of these gaps represent untested business logic or risky code paths that would warrant blocking.

Address TDD review feedback: add missing runUpdate command test
and delete confirmation acceptance ("y") path test.

Closes #101
@rianjs rianjs merged commit 736563a into main Feb 8, 2026
7 checks passed
@rianjs rianjs deleted the feat/101-project-management-commands branch February 8, 2026 11:53
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.

feat(jtk): add project management commands

1 participant