import type { CreateLabelOption, EditLabelOption, Label } from "gitea-js"; import { createClient } from "../client.js"; import { resolveRepoContext } from "../context.js"; import type { CliDeps } from "../deps.js"; import { axiError, classifyHttpError } from "../errors.js"; import { extractRow, pluck, type FieldDef } from "../fields.js"; import { flagValue, parseFlags, parsePositiveInt, parseSinglePositional } from "../flags.js"; import { findLabel, listAllLabels, resolveLabel } from "../lookup.js"; import { readTotalCount } from "../paginate.js"; import { formatCountLine, renderList, renderObject } from "../render.js"; import { suggestCommand } from "../suggestions.js"; export const LABEL_HELP = `usage: gitea-axi label [flags] commands: list List labels in the current repository create Create a label edit Edit a label's name, color, or description delete Delete a label Run \`gitea-axi label --help\` for the flags of a command. `; export const LABEL_LIST_HELP = `usage: gitea-axi label list [flags] List labels in the current repository. flags: --limit Maximum number of labels to return (default: 500) --help Show this help global flags: -R, --repo Override the repository detected from the git origin remote --login Select a tea login profile by name `; export const LABEL_CREATE_HELP = `usage: gitea-axi label create --name --color [flags] Create a label in the current repository. Idempotent: a label whose name already exists (case-insensitive) is reported rather than duplicated. flags: --name Label name (required) --color Label color as a hex code without \`#\` (required) --description Label description --help Show this help global flags: -R, --repo Override the repository detected from the git origin remote --login Select a tea login profile by name `; export const LABEL_EDIT_HELP = `usage: gitea-axi label edit [flags] Edit a label in the current repository. The positional name is resolved case-insensitively. At least one change is required. flags: --name New label name --color New color as a hex code without \`#\` --description New description --help Show this help global flags: -R, --repo Override the repository detected from the git origin remote --login Select a tea login profile by name `; export const LABEL_DELETE_HELP = `usage: gitea-axi label delete Delete a label in the current repository. The positional name is resolved case-insensitively. Deleting a nonexistent label is an error, not a silent success (see ADR 0010). flags: --help Show this help global flags: -R, --repo Override the repository detected from the git origin remote --login Select a tea login profile by name `; const DEFAULT_LIMIT = 500; const LABEL_LIST_HELP_SUGGESTION = ["Run `gitea-axi label list --help` to see available flags"]; // The list block carries only each label's name, per the spec. const LABEL_LIST_FIELDS: FieldDef