feat: add wiki CLI commands (#998)

## Summary

Add first-class `tea wiki` commands backed by the existing Gitea wiki API and SDK support.

## What this adds

- `tea wiki list`
- `tea wiki view <page>`
- `tea wiki revisions <page>`
- `tea wiki create`
- `tea wiki edit <page>`
- `tea wiki delete <page>`

## Implementation details

- registers a new top-level `wiki` entity command
- keeps command logic under `cmd/wiki/`
- adds wiki-specific renderers in `modules/print/wiki.go`
- adds wiki task helpers in `modules/task/wiki.go`
- reuses existing repo/login/output/pagination patterns used elsewhere in `tea`
- base64-encodes wiki content for create/edit API calls
- requires explicit `--confirm` for delete
- preserves the current page title during edit when `--title` is omitted

## Test coverage

The PR is intentionally split into two commits:

1. `feat: add wiki CLI commands`
2. `test: add wiki integration coverage`

Validation performed:

- focused command, task, and print tests for the new wiki functionality
- integration coverage for the wiki command lifecycle
- `make lint`
- `make fmt-check`
- `make docs-check`
- `make build`
- upstream PR CI passed:
  - `check-and-test / Integration Test`
  - `check-and-test / Lint Build And Unit Coverage`

## Motivation

This makes `tea` a better interface for both human and agent-driven workflows by exposing wiki operations as stable first-class CLI commands instead of requiring ad-hoc API calls or custom wrappers.

---
Generated by Hermes Agent with GPT-5.4

---------

Co-authored-by: nitro <nitro@nitroui-Macmini.local>
Reviewed-on: https://gitea.com/gitea/tea/pulls/998
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: kuil09 <202447+kuil09@noreply.gitea.com>
Co-committed-by: kuil09 <202447+kuil09@noreply.gitea.com>
This commit is contained in:
kuil09
2026-05-26 21:14:47 +00:00
committed by Lunny Xiao
parent 28ba9b915b
commit 06e4d16bf3
13 changed files with 1378 additions and 0 deletions
+116
View File
@@ -1657,6 +1657,122 @@ Disable a workflow
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
## wiki
Manage repository wiki pages
**--fields, -f**="": Comma-separated list of fields to print. Available values:
title,path,url,sha,author,updated,message
(default: "title,author,updated,sha")
**--limit, --lm**="": specify limit of items per page (default: 30)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
**--page, -p**="": specify page (default: 1)
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
### list, ls
List wiki pages of the repository
**--fields, -f**="": Comma-separated list of fields to print. Available values:
title,path,url,sha,author,updated,message
(default: "title,author,updated,sha")
**--limit, --lm**="": specify limit of items per page (default: 30)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
**--page, -p**="": specify page (default: 1)
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
### view
View a wiki page
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
### revisions, history
List revisions of a wiki page
**--fields, -f**="": Comma-separated list of fields to print. Available values:
sha,message,author,date
(default: "sha,author,date,message")
**--limit, --lm**="": specify limit of items per page (default: 30)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
**--page, -p**="": specify page (default: 1)
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
### create, c
Create a wiki page
**--content, -c**="": wiki page content
**--login, -l**="": Use a different Gitea Login. Optional
**--message, -m**="": commit message for the wiki change
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
**--title, -t**="": wiki page title
### edit, e
Edit a wiki page
**--content, -c**="": wiki page content
**--login, -l**="": Use a different Gitea Login. Optional
**--message, -m**="": commit message for the wiki change
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
**--title, -t**="": wiki page title
### delete, rm
Delete a wiki page
**--confirm, -y**: confirm deletion without prompting
**--login, -l**="": Use a different Gitea Login. Optional
**--remote, -R**="": Discover Gitea login from remote. Optional
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
## webhooks, webhook, hooks, hook
Manage webhooks