Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 7.3 KB

local-development.md

File metadata and controls

32 lines (18 loc) · 7.3 KB

Local development without GitHub

Hub can build and review committed branches from Git repositories on your computer. This development-only mode does not need a GitHub App, a remote prototype repository, or GitHub Actions. It keeps its own database and uses local artifact storage. Production cannot enable it.

Start

Start Hub in local mode from hub/:

cd hub
bin/devcontainer dev

On the first start, Hub copies the neutral starter into hub/.local/prototypes/example, commits main, and creates three independent, committed examples: prototype/welcome, prototype/field-notes, and prototype/signal-room. The default branch also contains those authored layouts at /#/welcome, /#/field-notes, and /#/signal-room, declared in .github/replica.json. Their pages, shared route adapter, styles, and manifest live under hub/db/seeds/local/example/; they do not change the reusable starter. The example branches open at /, where their full-page screenshots are captured. Hub downloads their shared Build dependencies. Setup only seeds when the prototype directory is empty; later starts leave every repository and branch untouched while ensuring the shared Build action's dependencies are ready. Existing examples do not gain template routes automatically. To try the new seed, use a new empty local prototype root rather than replacing a repository you have edited. The directory is ignored by Git and visible inside the devcontainer.

Open http://replica.localhost:19500 and choose Open local Hub. The local identity can view and change the configured local repositories; it does not represent a GitHub user or test GitHub permissions. Hub discovers the three example branches within about a minute and queues a Build for each. Reload the repository page to see three separate alerts saying Hub detected each branch locally. Choose Add to Hub on an alert to register that branch immediately with its branch name as its title. Each root page is taller than the desktop and narrow capture viewports, so the shared local Build pipeline captures full-page screenshots. Registered branches show their cards in the gallery, and Manage prototypes lets you edit their titles and descriptions.

Hub checks committed local branches once a minute and creates a Build when the default branch or a non-default branch points to a new commit. Reload the repository page after the scan to see the result. Hub saves when it first observes a candidate branch head or sees that head change. For 12 hours after that observation, an unregistered branch offers Add to Hub in the gallery. Refreshing or restarting Hub does not reset an unchanged head's age, and commit dates never count as local activity. On upgrade, existing local branches receive their first saved observation on the next scan without replacing their Builds or metadata. Registered and deleted branches do not appear in the alerts.

A discovered branch stays out of the gallery until you add it through an alert or Manage prototypes. Older branches remain available on the management page, where you can give them a name and optional description before adding them. Builds and direct review links remain available before registration. Hub builds an isolated checkout of the exact commit, so uncommitted edits do not appear in the Build. The existing package checks, artifact storage, preview origins, and review comments remain in use. A failed build stays in history with its error; an unchanged branch does not trigger another Build.

Templates shows the local repository's latest successful default-branch layouts and their actual screenshots. Default opens /; the fresh seed also offers Welcome, Field notes, and Signal room. Template details never import .prototype or offer review comments, registration, public shares, or a Copilot app handoff. The bottom What changes would you like to make? composer copies your brief, the currently viewed preview route, and instructions to create a new prototype branch from the current default branch. Paste the prompt into your coding agent; Hub does not create the branch. The Default composer also works before a successful Build is available, without adding page context, and reports clipboard success or failure. If the default branch disappears after a rename, the next scan considers main, master, or the checked-out branch. It never adopts a branch already discovered as a prototype. Without a safe replacement, Hub retains the stored default; a detached HEAD does not stop discovery of other branches. Former default Build owners remain internal. See Gallery for unavailable and newer-Build states.

To add another repository, create another Git repository directly beneath .local/prototypes/. Hub discovers it on the next scan; reload the repository page to see it in the selector. Each immediate subdirectory must be its own Git repository with a committed default branch and a package.json, package-lock.json, and build script. Hub assigns a private ID in that checkout's .git/config; it never enters a commit. Replacing the checkout at the same path creates a new Hub repository, and old Builds and comments cannot be accessed through the replacement. A broken checkout is logged without stopping Builds for other repositories; fix it and Hub will try again on the next scan. Do not place production data or unrelated repositories in this directory.

Local mode does not install a repository workflow, create a prototype through GitHub Copilot, publish a branch, or test collaboration across GitHub accounts. Use GitHub-backed development for those flows. Hub itself makes no GitHub requests in local mode, except the Copilot requests that Find learnings now makes; see Learnings. The first setup and new prototype dependencies may need downloads. Local Builds install npm dependencies from the cache only and report a missing package instead of contacting the registry; run npm ci in the repository while online after adding a dependency. Prototype build scripts themselves are not network-isolated.

Choose Create in the sidebar to compose a brief and add optional details, or browse the Templates catalog below the form. Open a card to preview and start from that template. Local mode offers Copy prompt instead of a Copilot app handoff. Paste the copied prompt into an agent session in the local repository to create the branch and implement the prototype. Copying does not create a branch or Build. See Gallery for catalog and prompt behavior.

Builds capture screenshots with the devcontainer's Chromium at /usr/bin/chromium. When Hub runs somewhere without it, run npx playwright install chromium in actions/build once Hub's first start has installed that folder's dependencies, or set PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH to a Chromium or Chrome executable before starting Hub; a configured executable takes precedence. Relative paths in PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH and PLAYWRIGHT_BROWSERS_PATH count from actions/build.

Stop bin/devcontainer dev with Ctrl+C. Run REPLICA_LOCAL_MODE=0 bin/devcontainer dev (or false) to use the GitHub-backed development path. The default applies only to dev; set REPLICA_LOCAL_MODE=1 explicitly for local-mode bin/devcontainer exec and shell commands. The local database and previews remain on disk until you remove them.