refactor: remove features beyond the UX plan

Drop additions that the UX plan does not ask for:

- the interactive label edit form; label edit now requires a flag
- label clone and the skip mode of label creation it needed
- repo rename rewriting the Git remote or tea.repository; it now
  warns that the remote still points to the old name
- the extra "source" remote on clones of pull mirrors
- run artifact download, which duplicates run download --zip
- 256-color and 24-bit label swatches; colors stay ANSI 16
- config list --show-source (config get keeps it)
- the membership and access GETs before team member/repo add and
  remove; Gitea's PUT and DELETE are idempotent

label edit/delete keep --by-name: it is the only way to address a
label whose name is a number that is also another label's ID.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 10:36:50 +02:00
1 parent 2ec16292f5
commit ea13c9e4f5
22 files changed
+69 -560

No files matched your search

+3 -52
View File
@@ -487,13 +487,6 @@ func (a *application) cloneRepository(cmd *cobra.Command, t target, item service
}
a.done(cmd, "Added remote %s for %s; tea commands in the clone target it (change with tea repo set-default)", opts.upstream, item.Parent.FullName)
}
// The remote is named source because repository discovery prefers a remote named upstream.
if source := mirrorSourceURL(item); source != "" {
if _, err := a.gitIn(cmd.Context(), clone, "remote", "add", "--", "source", source); err != nil {
return clone, fmt.Errorf("cloned the mirror, but could not add the source remote: %w", err)
}
a.done(cmd, "Added remote source for the mirror's source")
}
return clone, nil
}
@@ -593,9 +586,7 @@ func (a *application) repoRenameCommand() *cobra.Command {
command := &cobra.Command{
Use: "rename <new-name>",
Short: "Rename a repository",
Long: `Rename a repository; its owner stays the same. Gitea redirects the old name to the new one. When
the repository was found through a Git remote of the current clone, or through tea repo set-default,
that remote or setting moves to the new name.`,
Long: "Rename a repository; its owner stays the same. Gitea redirects the old name to the new one.",
Example: `# Rename the repository of the current clone
$ tea repo rename new-name
@@ -630,8 +621,8 @@ $ tea repo rename new-name -R alice/old-name`,
return err
}
a.done(cmd, "Renamed repository %s to %s", t.Repo, item.FullName)
if err := a.followRename(cmd, t, current, item); err != nil {
return err
if remote, ok := strings.CutPrefix(t.RepoSource, "remote "); ok {
a.warn(cmd, "Git remote %s still points to %s; update it with git remote set-url", remote, t.Repo)
}
return a.writeMutationJSON(cmd, item)
},
@@ -639,46 +630,6 @@ $ tea repo rename new-name -R alice/old-name`,
return command
}
// followRename points the Git remote or the saved default repository that selected a renamed
// repository, previously named old, at its new name.
func (a *application) followRename(cmd *cobra.Command, t target, old string, item services.Repository) error {
if remote, ok := strings.CutPrefix(t.RepoSource, "remote "); ok {
raw, err := a.git(cmd.Context(), "remote", "get-url", remote)
if err != nil {
return fmt.Errorf("renamed %s, but could not read Git remote %s: %w", item.FullName, remote, err)
}
renamed, ok := renamedURL(raw, old, item.Name)
if !ok {
a.warn(cmd, "Git remote %s still points to %s; update it with git remote set-url", remote, t.Repo)
return nil
}
if _, err := a.git(cmd.Context(), "remote", "set-url", remote, renamed); err != nil {
return fmt.Errorf("renamed %s, but could not update Git remote %s: %w", item.FullName, remote, err)
}
a.done(cmd, "Updated Git remote %s to %s", remote, item.FullName)
}
if t.RepoSource == "git config tea.repository" {
if _, err := a.git(cmd.Context(), "config", "--local", "tea.repository", t.Host+"/"+item.FullName); err != nil {
return fmt.Errorf("renamed %s, but could not update the default repository: %w", item.FullName, err)
}
a.done(cmd, "Set %s as the default repository for this clone", item.FullName)
}
return nil
}
// renamedURL replaces the repository name old at the end of a remote URL with name, keeping the
// rest of the URL, such as an SSH host alias, and its .git suffix.
func renamedURL(raw, old, name string) (string, bool) {
base, suffix := strings.TrimSuffix(raw, "/"), ""
if trimmed, ok := strings.CutSuffix(base, ".git"); ok {
base, suffix = trimmed, ".git"
}
if len(base) <= len(old) || !strings.EqualFold(base[len(base)-len(old):], old) || !strings.ContainsRune("/:", rune(base[len(base)-len(old)-1])) {
return "", false
}
return base[:len(base)-len(old)] + name + suffix, true
}
func (a *application) repoDeleteCommand() *cobra.Command {
command := &cobra.Command{
Use: "delete [<repository>]",