Skip to content

refactor: rewrite wikisync in Go - #5

Merged
CameronBrooks11 merged 2 commits into
mainfrom
feat/go-port
Oct 21, 2026
Merged

CameronBrooks11 merged 2 commits into
mainfrom
feat/go-port

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

Rewrites wikisync in Go, replacing the Python implementation. Same tool, same
behaviour, better distribution: a single static binary instead of a Python +
uv install.

  • Ported pull, status, diff to Go, preserving the CLI surface and the
    .wikisync on-disk format (manifest schema v2, baseline snapshots keyed by
    page id). A working tree pulled by the Python version is readable unchanged.
  • Read client is plain net/http + encoding/json (no MediaWiki client
    dependency yet); unified diffs use go-difflib.
  • Toolchain: Go modules replace uv/pyproject; justfile and pre-commit
    switch to gofmt / golangci-lint / go vet / go test -race.
  • Release: release.yml now builds cross-platform binaries with GoReleaser
    and attaches them to a GitHub Release (PyPI publishing removed).

One behaviour change: CLI flags now precede page titles (Go's flag
convention), e.g. wikisync pull --dir ./pages "Title".

Verification

Locally: go build, go vet, go test -race ./... (all packages pass),
gofmt clean, and goreleaser check validates .goreleaser.yaml. Live
end-to-end against Appropedia: pulled "Welcome to Appropedia" (pageid 14533,
baseline written), status reported unchanged then modified after an edit, and
diff produced the expected unified diff with the rev 1264646 label.

golangci-lint could not run on the dev machine — its Go toolchain (1.27.3) emits
export-data version 5, which golangci-lint 2.13.1 cannot read (max 4). CI pins
Go 1.23 via go.mod, where golangci-lint runs normally, so just check
(fmt-check + lint + vet) is exercised here.

Deferred (unchanged plan)

push — bot-password auth from env, baserevid preflight, preview-by-default
with --apply, tested against a controlled wiki. Now with a Go MediaWiki client
(e.g. go-mwclient) for the login/edit-token flow.

Reimplement pull, status and diff in Go, preserving the CLI surface and
the .wikisync on-disk format (manifest v2, baseline-by-pageid). The read
client is plain net/http + encoding/json; diffs use go-difflib. Ships as a
single static binary instead of a Python package.

- Replace the uv/pyproject toolchain with Go modules; justfile and
  pre-commit switch to gofmt / golangci-lint / go vet / go test.
- CI runs the Go gate; release.yml now builds cross-platform binaries with
  GoReleaser (GitHub Releases) instead of publishing to PyPI.

CLI flags now precede page titles (Go flag convention).
@CameronBrooks11
CameronBrooks11 merged commit b2d9631 into main Oct 21, 2026
5 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/go-port branch October 21, 2026 22:54
CameronBrooks11 added a commit that referenced this pull request Nov 11, 2026
CodeQL's first run on this repo raised 5 medium
`actions/missing-workflow-permissions` alerts (#1-#5), one per job in
`.github/workflows/check.yml`, because the workflow declares no
`permissions:` block.

The repo's default workflow token is already `read` (`GET
repos/CameronBrooks11/wikisync/actions/permissions/workflow` →
`"default_workflow_permissions":"read"`), so this pins that in the file
rather than changing behaviour. `pull-requests: read` covers
`dorny/paths-filter`, which lists a PR's changed files through the API.

This PR's own run exercises the `pull_request` path of `paths-filter`
under the new permissions; the alerts should close on the next CodeQL
run after merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant