Skip to content

Conversation

@mcepl
Copy link
Contributor

@mcepl mcepl commented Nov 29, 2025

This PR is completely vibe coded. I plan to review this code completely and test thoroughly, but if somebody who knows Golang and git-bug API better me (i.e., almost anybody), I am all ears for any suggestions.

  • Add complete todosrht bridge with GraphQL client and API integration
  • Implement full CRUD operations for tickets, comments, labels, and events
  • Add comprehensive test suite with mock client and authentication
  • Update bridge registry to include TodoSourceHut implementation
  • Add configuration management and validation for SourceHut instances
  • Include import/export functionality for bidirectional sync
  • Update documentation with man pages and usage guides
  • Add proper error handling and pagination support

Fixes: #1024

@mcepl mcepl marked this pull request as draft November 29, 2025 23:28
@mcepl mcepl force-pushed the todosrht branch 9 times, most recently from 8c0d156 to e76ef40 Compare December 5, 2025 00:07
@sudoforge sudoforge mentioned this pull request Dec 6, 2025
mcepl added 17 commits January 28, 2026 01:14
Fixes 'concurrent map read and map write' error in TestImporter by
wrapping memfs with a RWMutex for synchronized access.
- Add complete todosrht bridge with GraphQL client and API
  integration
- Implement full CRUD operations for tickets, comments, labels,
  and events
- Add comprehensive test suite with mock client and
  authentication
- Update bridge registry to include TodoSourceHut implementation
- Add configuration management and validation for SourceHut
  instances
- Include import/export functionality for bidirectional sync
- Update documentation with man pages and usage guides
- Add proper error handling and pagination support

Fixes: git-bug#1024
Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
Add support for full URL parsing and enhance error reporting for
better user experience:

* Add parseTodoURL() to extract base URL and tracker from full
  URLs like https://todo.sr.ht/~owner/tracker
* Implement two-step validation: check tracker existence first,
  then verify credentials separately
* Add TrackerExists() method for public tracker access checking
* Improve error messages to distinguish between "tracker doesn't
  exist" vs "invalid credentials"
* Add todo.sr.ht example to bridge new command help documentation
* Update mock client to implement the new interface

Users can now use the more intuitive --url flag with full
todo.sr.ht URLs and receive clearer feedback when configuration
fails.

Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
gokart seems to be completely dead these days
1. GraphQL query restructuring: Fixed queries to use me.trackers and
   me.tracker structure
2. Submitter field handling: Changed to *json.RawMessage with new
   GetSubmitter() method for proper type unmarshaling
3. API parameter changes: GetTickets() now uses trackerName instead of
   trackerID
4. URL parsing fix: Extract only tracker name from owner-prefixed URLs
5. Error handling: Added tracker validation and better submitter parsing
…r access

- Replace me.trackers query with tracker(name: String!) query  
- Add getTrackerByNameQuery for public tracker access
- Fixes blocking bug preventing bridge configuration for public trackers

Resolves issue where users couldn't access trackers they don't own
- Add CreateLabel, DeleteLabel, AssignUser, UnassignUser methods
- Completes client interface for full todo.sr.ht API coverage
- Enables label creation and user assignment functionality
- Add CreateLabel, DeleteLabel, AssignUser, UnassignUser mock methods
- Completes mock client interface for full API coverage
- Add createTodoSRHTLabel helper function with validation
- Auto-create missing labels during export with default colors  
- Improve error messages for label operations
- Add input validation for label names
- Enhance error handling with detailed messages

Resolves issue where missing labels caused export failures
- Handle Assignment events in ensureEvent function
- Map assigner and assignee to git-bug identities  
- Emit warnings for assignment events (git-bug has no native assignment)
- Completes import coverage for all todo.sr.ht event types
- Add json import for JSON marshaling
- Fix mock function signatures to match interface
- Convert User entities to JSON raw messages for API compatibility
- Resolves compilation errors in test suite
- Add TestTrackerExists for public tracker access validation
- Add TestCreateLabel for label creation functionality  
- Add TestAssignUser for user assignment operations
- Add TestDeleteLabel for label deletion operations
- Provides complete test coverage for all new client methods
- Add MockCreateLabel, MockDeleteLabel, MockAssignUser, MockUnassignUser
- Update mock client to support all new GraphQL mutations
- Enables testing of label creation and user assignment functionality
- Add comprehensive feature list with import/export capabilities
- Document new label creation and user assignment functionality  
- Add troubleshooting section for common issues
- Include usage examples for all major operations
- Document advanced features and error handling improvements
The GraphQL query for GetEvents was updated to correctly traverse the
schema via `me.tracker.ticket` instead of a direct top-level `ticket`
query. This change aligns the client with the current todo.sr.ht API
structure.

The `GetEvents` function signature and its mock implementation were updated
to accept `trackerName` as a parameter. Corresponding call sites in
`import.go` and `import_test.go` were also adjusted to pass this new parameter.

A minor whitespace adjustment was also made in `doc/usage/todosrht.md`.
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.

Sourcehut Support

1 participant