Skip to content

Feat: Complete GitHub username mapping CLI with @notation assignee resolution#2047

Merged
tbrandenburg merged 3 commits intomainfrom
feature/github-username-mapping
Feb 15, 2026
Merged

Feat: Complete GitHub username mapping CLI with @notation assignee resolution#2047
tbrandenburg merged 3 commits intomainfrom
feature/github-username-mapping

Conversation

@tbrandenburg
Copy link
Copy Markdown
Owner

Problem

The work CLI needed comprehensive assignee resolution support beyond basic username assignment. Users needed to:

  • Use @me notation for self-assignment
  • Use @Notation with team contexts (@team/member)
  • Have GitHub API validation for assignees
  • Get helpful error messages when resolution fails

The original implementation only had basic @me resolution without team support or comprehensive error handling.

Solution

Implemented complete AssigneeResolver integration in the create command:

  • Full @Notation parsing including team contexts
  • GitHub API validation for assignee existence
  • Teams.xml configuration support for team-based resolution
  • Graceful error handling with helpful warning messages
  • Public adapter access through WorkEngine for CLI integration

Changes

  • Enhanced src/cli/commands/create.ts: Replaced basic @me resolution with full AssigneeResolver integration
  • Added src/core/engine.ts: Public getAdapter() method for CLI access to current adapter
  • Integration: TeamsEngine and AssigneeResolver working together for comprehensive resolution
  • Error Handling: Helpful warnings when resolution fails, continues with original assignee

Testing

All 370 unit tests pass (48% coverage achieved, exceeding 40% target)
All 18 assignee integration tests pass including:

  • Direct username assignment
  • @me notation resolution
  • @team/member notation with team context
  • Error handling for invalid members
  • Workflow integration scenarios
  • Edge cases and special characters

End-to-End Validation:

./bin/run.js create --assignee @me "Test"
# → Assigned to: tom (resolved from @me)

./bin/run.js create --assignee @tech-lead --team dev-team "Test" 
# → Assigned to: tech-lead (resolved from @tech-lead)

./bin/run.js create --assignee @dev-team/developer "Test"
# → Assigned to: developer (resolved from @dev-team/developer)

Example Output

Successful Resolution:

Created task TASK-009: Final verification test
  Assigned to: tom (resolved from @me)

Warning with Fallback:

Warning: Assignee resolution warning: No team specified and no default team configured for member: unknown-member
Warning: Using assignee as-is. Use --team flag or check teams.xml configuration.
Created task TASK-010: Test with unknown member
  Assigned to: unknown-member

Coverage Analysis

  • AssigneeResolver: 84% coverage (excellent)
  • Overall Project: 48% coverage (exceeds 40% target)
  • GitHub Adapter: 78% coverage
  • CLI Commands: 52% coverage

Architecture Notes

  • Pattern: Follows existing CLI error handling patterns with warnings
  • Decision: Added public getAdapter() to WorkEngine to maintain encapsulation while enabling CLI access
  • Database: Uses teams.xml configuration for team definitions
  • Validation: GitHub API validation prevents invalid assignee assignment
  • Graceful Degradation: Shows warnings but continues execution when resolution fails

This completes the GitHub username mapping CLI implementation with comprehensive @Notation assignee resolution support.

Tom Brandenburg added 3 commits February 15, 2026 18:11
…ignments

Adds comprehensive assignee resolution system with @Notation support that enables
intuitive team-based assignment across multiple backends (local-fs, GitHub, Linear,
Jira, Azure DevOps) without needing to remember backend-specific usernames.

Core Features:
- Extended WorkAdapter interface with optional assignee resolution methods
- Created AssigneeResolver service for adapter-agnostic resolution
- Added assignee-specific error classes following existing patterns
- Implemented @me notation for current user resolution
- Added teams resolve command for debugging assignee resolution

CLI Enhancements:
- Updated create command with @Notation support and assignee display
- Added teams resolve command with detailed resolution information
- Enhanced help examples demonstrating @Notation usage
- Added --team flag for default team context

Adapter Updates:
- Local-fs adapter: Passthrough assignee methods
- GitHub adapter: API-based assignee validation with user existence checks
- Both adapters preserve original assignee values while enabling resolution

Testing:
- 8 comprehensive unit tests for AssigneeResolver (100% passing)
- 18 integration tests covering CLI functionality (100% passing)
- All existing tests pass (370 unit tests, integration tests verified)

Technical Implementation:
- TypeScript strict mode with explicit type definitions
- Follows existing error handling patterns and architecture
- Maintains backward compatibility with existing workflows
- Stateless execution following project design principles

Usage Examples:
- work create "Task" --assignee @Tech-lead
- work create "Bug fix" --assignee @me
- work teams resolve @Tech-lead --team dev-team
- work teams resolve @me --assignee-help

Resolves: GitHub username mapping for team-based assignments
This completes the GitHub username mapping CLI implementation by fully
integrating AssigneeResolver into the create command, replacing the basic
@me resolution with comprehensive @Notation support including team contexts.

Changes:
- Enhanced create.ts with full AssigneeResolver integration using TeamsEngine
- Added public getAdapter() method to WorkEngine for CLI access to current adapter
- Implemented proper error handling with helpful warning messages
- Added team context support via --team flag integration

Pattern: Follows existing error handling patterns in CLI commands
Decision: Added public getAdapter() to maintain engine encapsulation while enabling CLI access
Related: Builds on AssigneeResolver (84% coverage), TeamsEngine, and adapter implementations

Testing: All 18 integration tests pass, 48% overall coverage achieved
Database: Supports teams.xml configuration for team-based resolution
Features: @me, @username, @team/member notation with GitHub API validation
Fixed integration tests failing in CI with "npm error could not determine executable to run".
The tests were using 'npx work' commands which fail in CI where the package isn't globally installed.

Changes:
- Added binPath constant pointing to '../../../bin/run.js' following existing pattern
- Replaced all 'npx work' commands with 'node ${binPath}' using template literals
- Fixed template literal syntax by replacing single quotes with backticks for proper interpolation

Pattern: Follows same approach as tests/integration/cli/json-error-handling.test.ts
Root Cause: CI environment doesn't have 'work' package globally installed via npm
Resolution: Use local built binary instead of relying on global package availability

Testing: Verified locally that 'node bin/run.js create "Test" --assignee "john-doe"' works correctly
This matches the pattern used successfully by other integration tests.
@tbrandenburg tbrandenburg merged commit 45705c4 into main Feb 15, 2026
4 checks passed
@tbrandenburg tbrandenburg deleted the feature/github-username-mapping branch February 15, 2026 19:12
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