adopt.sh: --github-wiki flag (port from instantiate.sh) + README alias snippet - #59
Conversation
…s snippet Closes the UX gap that PRs #51 and #55 left open: adopting an existing repo still required four manual github.com clicks (enable Wikis, seed the first wiki page via UI, wire the wiki remote, push) before the wiki sub-repo could be published. The same dance was already automated by `scripts/instantiate.sh` for projects created from the template. Chris recommended (Slack, 2026-06-27) shipping --github-wiki on adopt instead of building a separate `gh` extension: the bundle case for an extension (version pinning, migrate-existing-wiki) isn't justified yet since neither has emerged as recurring demand. What this PR does scripts/adopt.sh: - New --github-wiki flag (declaration, usage text, case parser). - New Phase 2B sub-step: between init-wiki and overlay setup. When the flag is passed, derives the wiki URL via lw_origin_url + lw_wiki_url, attempts a seed-push to materialize <repo>.wiki.git on GitHub (mirrors instantiate.sh:486-499), and on success invokes init-wiki.sh with --github so it clones the now-real wiki. On the GitHub architecture quirk (first wiki page must exist via UI), seed-push returns 404 and adopt captures it into GITHUB_WIKI_STATUS=failed, prints the workaround on stderr via a new _github_wiki_fallback_message helper, and falls back to local init-wiki -- adopt remains exit 0, additive contract preserved. - Non-github origins (gitlab.com, self-hosted git) soft-skipped via an inline host check BEFORE lw_wiki_url is called (which would otherwise lw_die and crash the whole script). - Missing origin remote soft-skipped. - Dry-run (--github-wiki without --apply) runs read-only probes only (lw_origin_url, host check, lw_wiki_url, git ls-remote) and reports a 'would-apply' or 'would-skip' status in a new GITHUB WIKI section of the dry-run report. No mutation. - Manifest gains a '- github-wiki: <status> (<detail>)' line after the init-wiki line. Status vocabulary: applied | wiki-already-materialized | failed | skipped (with five distinct skip reasons enumerated in the detail). Three new integration fixtures: - adopt-apply-github-wiki-no-origin: virgin host without origin; verifies soft-skip + init-wiki local fallback + no workaround on stderr. - adopt-apply-github-wiki-fake-origin: virgin host with fake github URL; verifies seed-push 404 capture + workaround on stderr + init-wiki local fallback + manifest contains exact 'failed (seed-push 404; GitHub UI step required ...)' detail. - adopt-apply-github-wiki-non-github-origin: virgin host with gitlab origin; verifies inline host check catches the case BEFORE lw_wiki_url is invoked + manifest reports skipped (non-github host 'gitlab.com') with exact text. Mutation discriminators (observe-the-failure): replacing the empty-origin guard, the inline non-github host check, or the fallback-message call each turns the right assertions red across the relevant fixture and only those; revert returns 25/25 green. End-to-end on a real virgin host (Linux): scratch clone of crcresearch/ FUNSD with a fake-github origin, --apply --github-wiki. Manifest reports 'github-wiki: failed (seed-push 404; ...)' AND 'init-wiki: applied (ran wiki/init-wiki.sh --repo-name funsd-adopt-test)' (note: no --github flag, confirming local fallback fired). Exit 0. Dry-run separately verified to report the prospective status in the GITHUB WIKI section. Full local suite: 728 pass, 30 fail (baseline SCHEMA pre-existing) -- zero regression from main (which was 703 pass; +25 from the new fixtures). README.md: - New section 3, 'Adopt the pattern into an existing project', explaining the common adoption flow with --github-wiki and an alias snippet for power users who adopt multiple projects from one machine. Old sections 3-9 renumbered to 4-10. Reuse points (no helper changes needed): - lw_origin_url, lw_wiki_url, lw_repo_slug from scripts/lib/git.sh. - wiki/init-wiki.sh --github mode (already shipped). - 'command -v gh' guard pattern from instantiate.sh. - Manifest status-capture idiom (INIT_WIKI_STATUS, INIT_WIKI_DETAIL). Out of scope (deferred): - gh extension wrapper (defer until version-pinning or migrate-existing- wiki demands materialize). - Auto-pushing the wiki sub-repo content after init-wiki --github clones it (instantiate also leaves this manual; same precedent). - template-manifest.sh consolidation (Open Question #4 in the design page; tracked separately). Co-authored-by: Priscila Saboia Moreira <pmoreira@nd.edu>
|
End-to-end macOS bash 3.2.57 verification against Ran on Priscila's macOS, HEAD Test GW-A — virgin clone with NO origin (soft-skip path): Init-wiki invocation has no Test GW-B — virgin clone with fake-github origin (the 404 path the workaround targets): Notable: the re-run hint in the workaround block points at Test GW-C — dry-run preview: Read-only probes work; no side effects. Coverage summary:
All five CI jobs (Linux × 3 git versions + ubuntu-latest + macOS-latest) green at |
Adds two fixtures closing review-resolution gaps before marking PR #59 ready: adopt-apply-github-wiki-agent-none — verifies the github-wiki dispatch is agent-orthogonal. The seed-push runs (or fails with the 404 fallback) regardless of --agent=none. The overlay setup and its delegated TOUCH grants (CLAUDE.md managed-block, .claude/settings.json merge) skip with the --agent=none reason; the .gitignore append-only TOUCH still runs because it does not delegate to the overlay. 13 assertions. adopt-dryrun-github-wiki — verifies the dry-run preview block emits the GITHUB WIKI section with the prospective status (would-apply / would-skip), and that the host is NOT mutated: no manifest, no ADD files, no .gitignore change, no .claude/ directory. 13 assertions. Mutation discriminators driven on both fixtures: - Removing the dry-run preview block turns the dry-run fixture's GITHUB-WIKI assertions RED. - Adding an && AGENT != none guard to the github-wiki dispatch turns the agent-none fixture's manifest + stderr assertions RED. Revert returns 26 of 26 green. Full local suite: 754 pass / 30 fail (the 30 are pre-existing SCHEMA failures; +26 from the new fixtures over the prior 728). Also fills a documentation gap: wiki/Adopt-Existing-Repo-Design page gains a new 'Decision: --github-wiki flag' section recording the behavior matrix, the inline non-github host check, the dry-run preview semantics, the agent-orthogonality reasoning, and an empirical dry-run sweep across 9 real repos. Wiki commit: 3df0c7f. Co-authored-by: Priscila Saboia Moreira <pmoreira@nd.edu>
Temporary manual test script for Priscila to run on macOS bash 3.2.57 against chrissweet/FHI360_Lite. Exercises the two new fixtures from the review-resolution round end-to-end on a real host: - GW-D: --apply --github-wiki --agent=none - GW-E: dry-run --github-wiki (no --apply) Will be reverted in the next commit; not part of the merge target.
…w-resolution real-repo run) The script at scripts/test/manual/fhi360-gw-newfixtures.sh was pushed temporarily so Priscila could pull and run it on macOS to verify the two new review-resolution fixtures end-to-end against chrissweet/ FHI360_Lite. Both tests passed: GW-D (--apply --github-wiki --agent=none): RC=0; manifest reports github-wiki failed (seed-push 404), init-wiki applied without --github (local fallback), overlay setup skipped (--agent=none), CLAUDE.md (managed-block) and settings.json (merge) TOUCH grants skipped, .gitignore (append-only) created from canonical. GW-E (dry-run --github-wiki): GITHUB WIKI preview section emits would-apply with the prospective wiki URL; manifest NOT written, llm-wiki.md NOT copied, wiki sub-repo NOT created, .claude/ NOT created. Removing the script now that the verification is complete and recorded in the PR comment. Co-authored-by: Priscila Saboia Moreira <pmoreira@nd.edu>
|
Review-resolution gap closure: real-repo end-to-end on Linux + macOS bash 3.2.57 for the two new fixtures. After the original PR #59 round, two new fixtures were added in commit
Both fixtures green locally (754 pass / 30 baseline) and on CI. To close the discipline check, both were also exercised end-to-end against real hosts. Linux real-repo ( Test D-Linux — All 8 verification points pass: CLAUDE.md has no macOS bash 3.2.57 real-repo ( Test GW-D — 8 of 8 verification points pass. Test GW-E — dry-run Manifest NOT written, llm-wiki.md NOT copied, wiki sub-repo NOT created, Coverage matrix across all 5 fixtures:
Plus the dry-run preview sweep across 9 real repos (FUNSD, team-ai-Engineering, p28-behavioral-test, pad-analytics-workshop, pad-ml-pipeline, tai_ner, CSE-60868, llm-wiki-branch-test, markov_embeddings_and_rag) — covered in commit
|
|
macOS bash 3.2.57(1) verification done (macOS 15.4.1 arm64) against
Bonus data point: |
Context
Closes the UX gap PR #51 (adopt orchestrator) and #55 (default grants) left open: adopting an existing repo still required four manual github.com clicks (enable Wikis, seed the first page via UI, wire the wiki remote, push) before the wiki sub-repo could be published.
scripts/instantiate.shalready automates this dance via--github-wikifor projects created from the template.Chris recommended (Slack, 2026-06-27) shipping
--github-wikion adopt instead of building a separateghextension: the bundle case for an extension (version pinning, migrate-existing-wiki) isn't justified yet since neither has emerged as recurring demand.Planning trail and scope are in
/home/pmoreira/.claude/plans/cozy-soaring-honey.md.What this PR ships
scripts/adopt.sh--github-wikiflag (declaration, usage, parser).lw_origin_url+lw_wiki_url.<repo>.wiki.git(mirrorsinstantiate.sh:486-499).init-wiki.sh --githubso it clones the now-real wiki.GITHUB_WIKI_STATUS=failed, prints the workaround on stderr via new_github_wiki_fallback_messagehelper, falls back to localinit-wiki. Adopt remains exit 0, additive contract preserved.lw_wiki_urlis called (avoids itslw_die).--github-wikiwithout--apply) runs read-only probes and emits a newGITHUB WIKIsection withwould-apply/would-skipstatus. No mutation.- github-wiki: <status> (<detail>)line. Status vocabulary:applied | wiki-already-materialized | failed | skipped(five distinct skip reasons enumerated).Three new integration fixtures
adopt-apply-github-wiki-no-originorigin. Init-wiki local fallback. No 404 message on stderr.adopt-apply-github-wiki-fake-originfailed (seed-push 404; GitHub UI step required ...). Workaround block on stderr names the re-run command pointing atadopt.sh(notinstantiate.sh). Init-wiki local fallback.adopt-apply-github-wiki-non-github-origingitlab.comBEFORElw_wiki_urlruns (solw_dieis never triggered). Manifest reportsskipped (non-github host 'gitlab.com').Observe-the-failure mutations
Three targeted mutations applied during development; each turns the right assertions red and only those:
lw_wiki_urldies inside command substitution but the script continues with empty_wiki_url, garbage-cascading. The inline check is load-bearing for correctness, not just politeness.Revert → 25/25 green.
End-to-end verification
Real virgin host (Linux): scratch clone of
crcresearch/FUNSDwith a fake-github origin,--apply --github-wiki. Result:Note
init-wikishows NO--githubflag — local fallback fired. Adopt exit 0. Dry-run separately verified:GITHUB WIKI (--github-wiki preview; read-only)section appears withwould-apply (seed-push to ... wiki.git (master); wiki not yet materialized).README.mdNew section 3 "Adopt the pattern into an existing project" with the common adoption flow,
--github-wikibehavior, and the alias snippet:Old sections 3-9 renumbered to 4-10. Forward references updated.
Reuse points (no helper changes needed)
lw_origin_url,lw_wiki_url,lw_repo_slugfromscripts/lib/git.sh.wiki/init-wiki.sh --githubmode (already shipped).command -v ghguard pattern frominstantiate.sh.INIT_WIKI_STATUS,INIT_WIKI_DETAIL).Out of scope (deferred)
ghextension wrapper (defer until version-pinning or migrate-existing-wiki demands materialize).init-wiki --githubclones it (instantiate also leaves this manual; same precedent).template-manifest.shconsolidation (Open Question Attribute every wiki log entry to a user, one commit per log entry #4 in the design page; tracked separately).Test plan
chrissweet/FHI360_Lite(separate confirmation script for Priscila).Co-authored-by: Priscila Saboia Moreira pmoreira@nd.edu