You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ffeeae7
Browse filesBrowse the repository at this point in the historyBrowse files
fix(init-wiki): robust, owner-parametrised, token-aware wiki seeding (#90)
## What
Hardens `init-wiki.sh` — the estate work-around for GitHub having **no
API to create/seed a wiki** (the `.wiki.git` repo is created lazily on
first UI save; see the open feature request being filed at community
discussions).
## Why
The previous version had a `WIKI_DIR` quoting bug, was hardcoded to
`hyperpolymath/`, and — critically — never enabled the wiki, so the
lazy-init case silently printed "Failed to push" with no guidance.
## Changes
- **Fix** `WIKI_DIR=""$HYPATIA_TMPDIR/...` quoting bug → `mktemp -d` +
`trap` cleanup.
- **Owner-parametrised**: accepts `<owner>/<repo>` (or `$WIKI_OWNER`),
so it works for `metadatastician/*` etc., not just `hyperpolymath/*`.
- **Enable wiki first** via `gh api -X PATCH repos/<slug> -F
has_wiki=true` so the push target exists.
- **Token-aware remote**: `GH_TOKEN`/`GITHUB_TOKEN` → HTTPS
`x-access-token` (CI / GitHub App installation token); else SSH.
- **Idempotent**: `write_page` only creates missing pages — never
clobbers human-edited wiki content on re-run.
- **Actionable failure**: on push error, prints the real message and the
lazy-init fallback (create first page once via UI / browser-automation
agent, then re-run).
- `set -euo pipefail`.
## Verification
- `bash -n init-wiki.sh` → syntax OK
- `shellcheck -S warning init-wiki.sh` → no warnings
- Smoke test: owner/repo parsing (`metadatastician/paint-type` +
bare-repo default) and no-clobber idempotency confirmed.
Part of the "route around GitHub API limits for AI tooling" work (Arm
B2). Draft pending live run against a repo with no existing wiki.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments