feat(gitlab): add project wiki support to the GitLab connector#77
Open
MeEfe wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GitLab wiki connector
Closes #47.
GitLab stores project wikis separately from the repository, so this adds wiki
support to the existing GitLab connector. Add
?wiki=trueto agitlab:sourceto sync a project's wiki instead of its code — each wiki page becomes a file in
the KB, preserving the page hierarchy from its slug.
Usage
Uses the Project Wikis API (
GET /projects/:id/wikis), reusesGITLAB_TOKEN/GITLAB_URL, and adds no new dependency (httpx is already core).What's included
?wiki=trueflag - routes the GitLab connector to the wiki endpoint. Repo mode is byte-for-byte unchanged.gitlab:42/gitlab:42?wiki=true, used directly as the API:id. Handy when the namespace path is deep or awkward to encode.gitlab:group/subgroup/project?wiki=true, URL-encoding the full nested namespace.with_content=1on the list endpoint when available, and falls back toGET /wikis/:slugper page on instances that don't return content inline.Design note
I extended the existing GitLab connector with a
?wiki=truesource flag ratherthan adding a separate connector, following the query-string option convention
already used by the Jira connector (
jira:KEY?jql=...). This keeps the changecontained to
gitlab.pyand its source parser and leaves the repository codepath untouched. Happy to split it into a dedicated
gitlab_wiki:connectorinstead if you'd prefer.
Testing
Tested end-to-end against a self-hosted GitLab instance:
gitlab:org/repo?wiki=true) and the numeric ID (gitlab:42?wiki=true).oikb sync <source>), the.oikb.yamlconfig file, and the daemon API (built a Docker image from this branch and ran it as the daemon).Administrative/Local-information.md→ pathAdministrative), and that the request hits/projects/:id/wikis?with_content=1.Verified with mocked (respx) requests during development: subgroup path encoding
(
group%2Fsubgroup%2Fproject), the numeric-repo form, the older-GitLab per-pagefallback, and that repo mode is unchanged.