Introduces the web backend (auth, RBAC, project tokens, revisions), YouTrack-or-taskmaster backend choice in the TUI, and a first-pass embedded Svelte UI. The frontend is functional but needs a major rework. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
630 B
Go
30 lines
630 B
Go
package syncbackend
|
|
|
|
import (
|
|
"context"
|
|
|
|
"task/internal/youtrack"
|
|
)
|
|
|
|
// ListYouTrackProjects lists projects via a master/instance token.
|
|
func ListYouTrackProjects(ctx context.Context, baseURL, token string) ([]RemoteProject, error) {
|
|
client := &youtrack.Client{BaseURL: baseURL, Token: token}
|
|
projects, err := client.ListProjects(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]RemoteProject, 0, len(projects))
|
|
for _, p := range projects {
|
|
name := p.Name
|
|
if name == "" {
|
|
name = p.ShortName
|
|
}
|
|
out = append(out, RemoteProject{
|
|
Key: p.ShortName,
|
|
Name: name,
|
|
ID: p.ID,
|
|
})
|
|
}
|
|
return out, nil
|
|
}
|