Skip to content

fix(init-wiki): robust, owner-parametrised, token-aware wiki seeding#90

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/init-wiki-robust
Jul 20, 2026
Merged

fix(init-wiki): robust, owner-parametrised, token-aware wiki seeding#90
hyperpolymath merged 1 commit into
mainfrom
fix/init-wiki-robust

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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

The script is 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). Hardening:

- Fix WIKI_DIR quoting bug (""$HYPATIA_TMPDIR/...) -> mktemp -d + trap cleanup.
- Accept <owner>/<repo> (or $WIKI_OWNER); no longer hardcoded to hyperpolymath,
  so it works for metadatastician/* etc.
- Enable the wiki first via `gh api -X PATCH repos/<slug> -F has_wiki=true` so
  the push target actually exists.
- Token-aware remote: GH_TOKEN/GITHUB_TOKEN -> HTTPS x-access-token (CI / GitHub
  App installation token); else SSH.
- Never clobber human-edited pages (write_page only creates missing files).
- On push failure, surface the real error and the lazy-init fallback (create the
  first page once via UI / browser-automation agent, then re-run) instead of a
  silent "Failed to push".
- set -euo pipefail; passes `bash -n` and `shellcheck -S warning`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review July 20, 2026 16:54
@hyperpolymath
hyperpolymath merged commit ffeeae7 into main Jul 20, 2026
4 checks passed
@hyperpolymath
hyperpolymath deleted the fix/init-wiki-robust branch July 20, 2026 16:54
hyperpolymath added a commit to hyperpolymath/standards that referenced this pull request Jul 20, 2026
…Hub App) (#509)

## What

Adds `.github/actions/signed-push` — an estate composite action that
pushes a branch's local commits as GitHub **Verified** commits, using a
**GitHub App installation token** + `createCommitOnBranch` (via
`Asana/push-signed-commits`).

## Why (Arm B1)

Automation commits made with a PAT or `GITHUB_TOKEN` are **Unverified**.
Any branch whose ruleset enforces `required_signatures` then **cannot
merge** — this is exactly why **IDApTIK #28** is `BLOCKED` right now
(all 4 commits `verified=false / unknown_key`). A GitHub App authoring
commits via `createCommitOnBranch` produces Verified commits GitHub
signs itself, satisfying the rule.

The same App also unlocks `.github/workflows` edits (Workflows: write)
and `delete_repo` (Administration: write), retiring several "GitHub API
won't let AI tools operate" blockers at once.

## Details

- SHA-pinned: `create-github-app-token` v3.2.0 (`bcd2ba4…`),
`push-signed-commits` v1 (`6e073ae…`).
- README documents the one-time App setup and the caveat that PR-only /
merge-queue rules are **separate** from `required_signatures` — the App
may need adding to those rulesets' **bypass list**.

## ⛔ Blocked / not yet verifiable

Requires the org to **register the GitHub App** and set **`APP_ID`** +
**`APP_PRIVATE_KEY`** secrets before it can run. Draft until then. YAML
validated (parses as a valid composite action); not runnable in CI
without the App.

## Related

- Immediate estate-wide unblock for `required_signatures`: register the
SSH **Signing Key** so existing commits flip to Verified.
- Sibling work: `hyperpolymath/scripts#90` (wiki-seed adapter), and the
community feature request for a wiki API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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