feat(wiki): gitea_wiki cannot create/edit/delete pages although the Forgejo API supports it #10
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
gitea_wikiis read-only:listandgetonly. There is nocreate,updateordelete, so a wiki page cannot be written with the toolset — the only working path is cloning<repo>.wiki.git, committing and pushing.Verbatim tool output for an attempted write (t14btw, 2026-10-23):
Observed vs expected
unknown action— no way to create the first page, edit or delete one.Instance capability (verified against
/swagger.v1.json, Forgejo17.0.0+gitea-1.22.0)POST/api/v1/repos/{owner}/{repo}/wiki/newCreateWikiPageOptions{title, content_base64, message}PATCH/api/v1/repos/{owner}/{repo}/wiki/page/{pageName}DELETE/api/v1/repos/{owner}/{repo}/wiki/page/{pageName}This path was used successfully via a direct API call to publish
pvlb-infra/t14-deeps/wiki/DSH-Bootcamp; only the tool is missing.Root cause (checkout available)
lib/tool-defs/repos.js:63-76—gitea_wikidefinition: description "list, get"; parameters onlyaction,pageName,limit,page,owner,repo— notitle/content/message.lib/handlers/repos.js:133-141— handler implements only thelistandgetbranches; everything else returnsunknown action.lib/gitea-client.js:609-619— client exposes onlylistWikiPages()andgetWikiPage(); no create/update/delete methods.Proposed fix
lib/gitea-client.js: addcreateWikiPage(owner, repo, {title, content, message})(base64content_base64),updateWikiPage(owner, repo, pageName, …)anddeleteWikiPage(owner, repo, pageName)using the three endpoints.lib/tool-defs/repos.js: extendgitea_wikiwithaction: create|update|deleteplustitle,content,messageparameters; keeplist/getuntouched.lib/handlers/repos.js: add the branches, routed throughwrap(); use the houseconfirm: truepattern fordelete.T14-Setup-GuidecreatedT14-Setup-Guide.-.md(URL/wiki/T14-Setup-Guide.-), while canonical pages are managed as<Page-Title>.mdvia git. Prefer writing well-formed file names.Acceptance
createon a repo with an empty wiki returnsok: trueand the page is readable viaget/API (this also unblocks the scenario in #9).updatechanges content;deleteremoves the page (withconfirm: true).fetchcover create/update/delete success and 401/403.list/getbehaviour unchanged.Duplicate check
Searched open + closed: #4 covers the read half (
getreturnsOK); no issue exists for wiki writes. Not a duplicate.Layer
Plugin/tool gap →
dsh-gitea(correct repo).Implemented in
fbca62a(PR #15).gitea_wikinow supportscreate,updateanddeleteagainst the Forgejo 17 endpoints (POST /wiki/new,PATCH|DELETE /wiki/page/{pageName}), with the body base64-encoded,confirm: truerequired for delete, and 401/403 failures passed through.The naming quirk is handled in the tool:
listnow printsTitle (pageName: <slug>), and the description says to address pages by that slug. Live, an API-createdProbe-Pagegot the slugProbe-Page.-;get/update/deleteonly work with that slug.Live CRUD through the running plugin, on the empty
ml-lab/tarditswiki (cleaned up afterwards):Wiki page created: Probe-PageProbe-Page (pageName: Probe-Page.-)Last commit: 45edfa83 …83a1d1d8 test(wiki): update probeconfirm: true→ deleted; list →No wiki pages.Tests:
test/wiki.test.mjscovers create/update/delete, base64 encoding, 401/403, missingtitle/content, delete confirmation, and failure passthrough;npm test60/60.