Repository navigation
Drop the fork: setup.sh self-bootstraps from upstream; --org is explicit - #14
Conversation
The leg-fetch step in the assembly-root validate workflow now tries an App-minted token first (actions/create-github-app-token, pinned by commit sha) and falls back to the existing SHAPE_LEGS_TOKEN PAT. - new job-level env booleans SHAPE_LEGS_APP_SET / SHAPE_LEGS_TOKEN_SET (never secrets in an if:) - a small step reads .gitmodules and emits the comma-separated leg names this repository's owner also owns (a foreign-owned leg is excluded with a warning: an installation token is per-owner) - the mint step is guarded by SHAPE_LEGS_APP_SET, continue-on-error: false, and a dedicated failure step names both secrets and the required installation when a configured App cannot mint - the leg-fetch step resolves App token -> PAT -> none, exposes which source won as step output legs_credential, and the existing degrade semantics (naming/manifest always, pins only when legs available, fail only when a configured credential still could not fetch) are unchanged in shape, just credential-source-aware Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
- mint step is pinned by 40-hex commit sha, scoped to permission- contents: read, guarded without secrets in any if: - job env carries both SHAPE_LEGS_APP_SET and SHAPE_LEGS_TOKEN_SET - the leg-fetch step references steps.app-token.outputs.token before SHAPE_LEGS_TOKEN, and exposes legs_credential: app|pat|none - a misconfigured App fails loudly, naming both secrets and the required installation - the .gitmodules -> leg-name extraction is exercised as the real shell it is: the exact run: body of the 'leg repository names from .gitmodules' step is pulled out of the rendered template and run, unmodified, against a crafted .gitmodules covering HTTPS, SSH and a foreign-owned leg (excluded from the App token, warned about) - README.md's line-cap governance test moves 331 -> 359 with a new dated paragraph, matching the doc it guards Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Replaces the SHAPE_LEGS_TOKEN paragraph in README.md and templates/assembly-root/README.md with a 'Reading private legs in CI' section: preferred is a dedicated GitHub App (Contents: Read-only + Metadata: Read, installed on each consuming org), registered as org secrets SHAPE_LEGS_APP_ID and SHAPE_LEGS_APP_PRIVATE_KEY; fallback is the existing fine-grained SHAPE_LEGS_TOKEN PAT. Includes the exact gh secret set commands for both and the (unchanged) degrade behaviour, now credential-source-aware. scaffold-project.py and adopt-project.py's one-line NOTE printed when a private/internal leg is created now names both options, App first. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
When setup.sh is not running inside a checkout of openRepoShape (detected via git rev-parse --show-toplevel plus the presence of scaffold-project.py and contracts/repository-naming.yaml), it now clones opensoft/openRepoShape (default branch, --depth 1; overridable with $OPENREPOSHAPE_REPO and --shape-ref) into a temporary directory, re-runs itself from there with the same arguments, and removes the temporary checkout on exit unless --keep-shape-checkout is given. --org is REQUIRED in this self-bootstrap mode: there is no fork origin left to read an organisation from. Running from inside an existing checkout is unchanged, except that an origin resolving to opensoft (the upstream itself) now asks for an explicit --org instead of refusing outright — that refusal is narrowed to keep --allow-upstream-org as the guard against --org opensoft itself. Every scaffolded project already pins opensoft/openRepoShape directly (the shape pin) and update-shape.py reads straight from upstream, so a per-organisation fork never did anything but host this script — and its origin-based org detection was itself a defect. Ruled by Brett Heap: drop the fork. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Quick start is now one curl | bash line (plus a gh api / base64 form for orgs that block raw downloads) that self-bootstraps a temporary checkout, scaffolds, and cleans up. The from-a-checkout form survives as the developer path. Every remaining mention of forking now says what the standard's lockstep pin already makes true: a per-organisation fork is only for contributing changes to openRepoShape itself, never a prerequisite for running it or for staying current with it. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
The scaffold procedure no longer assumes a fork: it runs the one-liner (or setup.sh from a checkout) with an explicit --org, still shows the human the plan and waits for their yes, and never passes --allow-upstream-org on its own initiative — that flag now guards only --org opensoft itself. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
- a self-bootstrap end-to-end test: a lone copy of setup.sh outside any checkout, $OPENREPOSHAPE_REPO pointed at this checkout, scaffolds and removes its temporary shape checkout on exit - --keep-shape-checkout keeps that checkout and prints its path - self-bootstrap without --org refuses, naming --org - running from the upstream checkout (origin == opensoft) without --org refuses with the new, narrower message; --org opensoft explicitly still hits the old --allow-upstream-org guard unchanged - README.md's line cap moves 359 -> 388 for the Quick start rewrite Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Reviewer's GuideThis PR removes the operational need for organisation-specific forks by making setup.sh clone and execute the upstream shape from a temporary checkout, requiring --org when no trustworthy fork origin exists, and updating safeguards, documentation, and tests accordingly. Sequence diagram for setup.sh self-bootstrapsequenceDiagram
actor User
participant Setup as setup.sh
participant Git as git
participant Shape as openRepoShape
participant Scaffold as scaffold-project.py
participant Project as AssemblyRoot
User->>Setup: invoke with --org and project arguments
Setup->>Git: is_shape_checkout
alt outside an openRepoShape checkout
Setup->>Git: clone --depth 1 SHAPE_REPO into mktemp directory
opt --shape-ref provided
Setup->>Git: checkout SHAPE_REF
end
Setup->>Setup: bash temporary checkout/setup.sh with ORIGINAL_ARGS
Setup->>Scaffold: scaffold-project.py
Scaffold->>Project: create repositories and project files
Setup->>Project: make bootstrap
alt --keep-shape-checkout
Setup-->>User: print kept checkout path
else default cleanup
Setup->>Git: remove temporary checkout
end
else inside an openRepoShape checkout
Setup->>Setup: detect organisation from origin or explicit --org
Setup->>Scaffold: scaffold-project.py
Scaffold->>Project: create repositories and project files
Setup->>Project: make bootstrap
end
Flow diagram for setup.sh organisation resolutionflowchart TD
Start["setup.sh invoked"] --> Checkout{"openRepoShape checkout?"}
Checkout -- No --> Explicit{"--org provided?"}
Explicit -- No --> Reject["Refuse: --org is required"]
Explicit -- Yes --> Bootstrap["Clone shape to mktemp and re-exec"]
Checkout -- Yes --> Origin{"origin resolves to opensoft?"}
Origin -- Yes --> OrgArg{"Explicit --org provided?"}
OrgArg -- No --> RejectUpstream["Refuse: pass --org"]
OrgArg -- Yes --> Guard{"--org opensoft?"}
Origin -- No --> Resolve["Use --org or detect from origin"]
Bootstrap --> Guard
Resolve --> Guard
Guard -- "Yes, without --allow-upstream-org" --> RejectNamespace["Refuse opensoft namespace"]
Guard -- "No, or explicitly allowed" --> Scaffold["Validate, confirm, scaffold, bootstrap"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="setup.sh" line_range="178-180" />
<code_context>
+ # `--depth 1` only means something over a real transport; git warns and
+ # ignores it for a bare local path (what the tests use via
+ # $OPENREPOSHAPE_REPO), so skip it there rather than clone shallow noise.
+ case "$SHAPE_REPO" in
+ *://*) [ -n "$SHAPE_REF" ] || CLONE_SHAPE_CMD+=(--depth 1) ;;
+ esac
+ CLONE_SHAPE_CMD+=("$SHAPE_REPO" "$SHAPE_CHECKOUT")
+ say " ${CLONE_SHAPE_CMD[*]}"
</code_context>
<issue_to_address>
**nitpick (performance):** Self-bootstrap clones an SSH/scp-style `$OPENREPOSHAPE_REPO` without `--depth 1`, because the case only adds the shallow-clone option for URLs containing `://`; mirrors configured as `git@host:org/repo.git` therefore download the full repository history.
**Triggers:** When `OPENREPOSHAPE_REPO` uses an SSH/scp-style URL and `--shape-ref` is not supplied.
**Suggested fix:** Recognize SSH/scp URLs as remote transports too, or use Git's transport-independent shallow-clone handling.
```suggestion
case "$SHAPE_REPO" in
*://*|*:*/*) [ -n "$SHAPE_REF" ] || CLONE_SHAPE_CMD+=(--depth 1) ;;
esac
```
</issue_to_address>Sourcery assessment
Needs a human reviewer. The new default executes a script fetched from GitHub and then uses its arguments to create repositories, so a compromised, changed, or incorrectly trusted upstream script could run arbitrary local commands and leave repositories or other side effects behind. Reverting this PR would not undo code already executed or repositories already created.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| case "$SHAPE_REPO" in | ||
| *://*) [ -n "$SHAPE_REF" ] || CLONE_SHAPE_CMD+=(--depth 1) ;; | ||
| esac |
There was a problem hiding this comment.
nitpick (performance): Self-bootstrap clones an SSH/scp-style $OPENREPOSHAPE_REPO without --depth 1, because the case only adds the shallow-clone option for URLs containing ://; mirrors configured as git@host:org/repo.git therefore download the full repository history.
Triggers: When OPENREPOSHAPE_REPO uses an SSH/scp-style URL and --shape-ref is not supplied.
Suggested fix: Recognize SSH/scp URLs as remote transports too, or use Git's transport-independent shallow-clone handling.
| case "$SHAPE_REPO" in | |
| *://*) [ -n "$SHAPE_REF" ] || CLONE_SHAPE_CMD+=(--depth 1) ;; | |
| esac | |
| case "$SHAPE_REPO" in | |
| *://*|*:*/*) [ -n "$SHAPE_REF" ] || CLONE_SHAPE_CMD+=(--depth 1) ;; | |
| esac |
There was a problem hiding this comment.
🟡 Changes recommended
The new self-bootstrap output can leak credentials by echoing $OPENREPOSHAPE_REPO, and the README’s base64 -d one-liner is not reliably portable to macOS/BSD.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates setup.sh and documentation to remove the per-organisation fork requirement by adding a self-bootstrap mode that clones the upstream shape into a temporary checkout, re-executes setup.sh from there, and cleans up afterward, while making --org explicit when no fork origin exists.
Changes:
- Add self-bootstrap mode to
setup.sh(temp clone, optional--shape-ref, optional--keep-shape-checkout) and adjust org detection/guards accordingly. - Update README/AGENTS guidance to remove “fork first” instructions and document the new one-liners.
- Extend test coverage for the new self-bootstrap behavior and update the README line-count cap.
File summaries
| File | Description |
|---|---|
| setup.sh | Implements self-bootstrap via temporary clone + re-exec; adjusts org detection and upstream-org safeguards. |
| README.md | Replaces fork-based quickstart with `curl |
| AGENTS.md | Updates agent workflow instructions to align with “drop the fork” and explicit --org guidance. |
| tests/test_setup_sh.py | Adds self-bootstrap tests (temp checkout cleanup/retention, --org required behavior, upstream-checkout behavior). |
| tests/test_repo_hygiene.py | Updates README length cap and documents the cap change rationale. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| CLONE_SHAPE_CMD+=("$SHAPE_REPO" "$SHAPE_CHECKOUT") | ||
| say " ${CLONE_SHAPE_CMD[*]}" | ||
| "${CLONE_SHAPE_CMD[@]}" |
| gh api repos/opensoft/openRepoShape/contents/setup.sh --jq .content \ | ||
| | base64 -d | bash -s -- --org <your-org> --project Atlas |
Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T # Conflicts: # tests/test_repo_hygiene.py
|



Lane: repo-shape
Brett Heap's ruling: drop the fork.
Rationale
Every scaffolded project already pins
opensoft/openRepoShapedirectly (theshape pin,
contracts/shape-pin.yaml) andupdate-shape.pyreadsstraight from upstream, so a per-organisation fork was never load-bearing —
it only ever served as a place to run
setup.shfrom. Worse, itsorigin/upstream-remote org detection was itself a defect:
gh repo viewresolving
upstreaminstead oforigincould reportopensoftfor aperfectly correct fork. The MedxSoft fork has already been deleted.
What changed
setup.shnow self-bootstraps: when it is not running inside a checkout ofopenRepoShape (detected via
git rev-parse --show-toplevelplus thepresence of
scaffold-project.pyandcontracts/repository-naming.yaml), itclones
opensoft/openRepoShape(default branch,--depth 1; overridablewith
$OPENREPOSHAPE_REPOand--shape-ref <commit-or-tag>for a fork ormirror) into a
mktemp -dtemporary directory, re-executes itself from therewith the same arguments, and removes the temporary checkout on exit unless
--keep-shape-checkoutis given.--orgis REQUIRED in this mode — there isno fork origin to read it from. Run from inside an existing checkout and
behavior is unchanged, except that an
originresolving toopensoft(theupstream itself) now asks for an explicit
--orginstead of refusingoutright;
--allow-upstream-orgis kept only as the guard against--org opensoftitself.The one-liner:
curl -fsSL https://raw.githubusercontent.com/opensoft/openRepoShape/main/setup.sh \ | bash -s -- --org <your-org> --project Atlasplus a
gh api ... | base64 -d | bash -s --form for organisations thatblock raw downloads. README,
AGENTS.mdand the "from a checkout" developerpath are all updated to match: every instruction to fork is gone, replaced
with the fact that a fork is only ever useful for contributing changes to
the standard itself.
Base branch
This PR is stacked on #13's branch (
feat/legs-app-token) so the READMEand
AGENTS.mdedits layer on its already-landed text instead of conflictingwith it. The coordinator will retarget this PR to
mainafter #13 merges.Tests
python3 -m pytest tests -q→ 255 passed (25 intest_setup_sh.py,including 4 new self-bootstrap tests).
shellcheckis not available in thisenvironment, so it was not run;
bash -n setup.shpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Summary by Sourcery
Drop the organisation-specific fork requirement by making setup.sh bootstrap itself from upstream and require explicit target organisation selection.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: