Skip to content

Latest commit

 

History

History
169 lines (130 loc) · 12.2 KB

explore.md

File metadata and controls

169 lines (130 loc) · 12.2 KB

Explore Projections in this repository

This file guides you, a coding agent, to find the projections that apply to this repository, try them on its recent pull requests, and help the person choose which to keep and add to CI. You work with the Projections tools or the projections CLI, and show the person the projections yourself in the Projections viewer, a page on this machine that you drive and they watch. Nothing is written until they choose.

Your task

  1. Prefer the Projections tools when you have them: in VS Code’s agent the Projections extension offers them, and an MCP client gets them from projections mcp (an MCP server over standard input and output; add it as a stdio server run in this repository). They do each step below and answer in short text; writes preview first and write only once confirmed (over MCP, call again with the preview’s confirm token after the person agrees). Otherwise use the CLI commands below.
  2. Check the CLI: projections --version. If it is missing, install it by following https://github.com/githubnext/projections/blob/v0.3.2/docs/agents/install.md.
  3. Propose: the explore tool, or projections explore --list --json, lists the projections whose built-in extractors apply here, each with the files that suggested it and what it needs first (configuration, or an install such as the repository's own TypeScript): do that, or leave it out.
  4. Sweep: the sweep tool, or projections explore --sweep --json, runs each one on the last 20 merges into this branch (--last N for more). Projections that run repository code are skipped unless you pass --trust; ask the person first.
  5. Report, per projection, the pull requests it changed on and how (for example #12: 3 added, 1 removed), why it failed when it did (the sweep gives the extractor's own words), and its signal, which ranks the sweep: rare (only on structural work: worth a look), noisy (on nearly every change: likely noise, so don’t recommend it) or quiet (never changed here, or only version updates: a dependency or action bump marked versionOnly); and the pull requests where several changed. Recommend projections that show something characteristic of this codebase (the picture a long-time maintainer would recognize as theirs), not just the ones that change least. Don’t add repository-map or code-statistics, which explore no longer proposes: they only show what Projections can draw, not this codebase. To look at one yourself, draw it: projections compare <before>..<after> -p <id> --png FILE (a new file outside the repository).
  6. Ask the person which projections to keep. Never adopt or change CI on your own; a request to set projections up for them is their go-ahead to adopt the few the sweep shows are worth having, so you can show them. Say which you adopted and why.
  7. Adopt what they chose: projections adopt <id>... --dry-run, then projections adopt <id>.... Built-in projections fit standard systems like Actions workflows, database schemas and package dependencies, but rarely cover what’s distinctive about a codebase. Name the characteristic systems they missed (its own registries, extension points, protocols, pipelines) and offer to build projections for them, usually with custom renderers. To build one, run projections help agents create-projection and follow what it prints.
  8. Show them each adopted projection yourself: projections view show -p <id> --choice bookmark:<bookmark> (or the open_projection tool) shows it in the Projections viewer on a pull request it changed on (projections bookmark list lists the ones adopt saved) and prints the viewer’s URL. When the person asks to “open it in the inspector” or to “show” a projection, they mean this viewer.
  9. Open that page for them the first time: in your own browser if you have one (Codex’s, for example), else in the system browser by adding --open. Give them the bare link only when you can open neither. Later projections view show calls change what the open page shows; to show several projections side by side, give each its own page with --viewer <name> (the viewer input), and open each. In the GitHub Copilot app, use the Projections canvas instead of a browser tab: run projections canvas install once, then open the projections canvas, which shows the same viewer in the app’s theme (one canvas per viewer name).
  10. Talk them through what each one shows, and remove the definitions of any they don’t want. People who want an editor-integrated experience closer to the code can also use the VS Code extension (Projections: Explore Repository, under “Alternate path: the VS Code extension” below).
  11. When they are happy, offer to add Projections to their CI: run projections help agents ci and follow what it prints. Commit only if they ask.

Projections maps the systems inside your codebase—dependencies, schemas, infrastructure, workflows, service wiring—without making you wade through lines of code, and shows how a change reshapes them. Because the right projections depend on your repository, setup starts by exploring your repository in five minutes against its own recent pull requests. From there, you keep the ones that actually tell you something useful and wire those into CI.

Estimated time: 5 minutes.

The quickest route is to let your coding agent run the projections CLI and open the results in the Projections viewer, a local page it drives in your agent's in-app browser or a standalone browser while you watch. Paste this into your coding agent, or follow the CLI steps below yourself:

Explore Projections in this repository: run `projections help agents explore` and follow what it prints (if `projections` isn't installed, install it first by following https://github.com/githubnext/projections/blob/main/docs/agents/install.md). Use the projections CLI to find the projections that apply here and try them on our recent pull requests, tell me which are worth keeping, then adopt the ones I pick and show them to me in the Projections viewer. Don't change CI until I say so.

If you'd rather work right beside your code inside an editor, jump to Alternate path: the VS Code extension below.

Prerequisites

  • A Git repository with some history—merged pull requests, or at least a few commits.
  • GitHub CLI (gh), signed in (gh auth status), so you can download and verify the CLI binary.

Step 1: Install the CLI

Your coding agent, your terminal, and CI all run the same self-contained projections CLI. Download the release asset for your platform, verify its attestation, and place it on your PATH:

gh release download --repo githubnext/projections --pattern 'gh-projections-darwin-arm64*'
gh attestation verify gh-projections-darwin-arm64 --repo githubnext/projections
install -m 755 gh-projections-darwin-arm64 ~/.local/bin/projections
projections --version

See Install the CLI for every platform's asset, installer scripts, Windows steps, and how to run it as gh projections.

Step 2: Explore your repository

From the root of your repository, ask Projections which built-ins apply:

projections explore

This inspects your files without writing anything and proposes matching projections along with why each one fits—workspace dependencies if it finds package manifests, a database schema if it spots a Prisma schema or a Rails db/schema.rb, Rails routes, your GitHub Actions job graph, and so on.

Next, test those candidates against real history by sweeping the last 20 merges into your branch (or your most recent commits if you squash or rebase):

projections explore --sweep

The sweep reports how often each projection changed across those pull requests and distinguishes noisy ones (changing on nearly every pull request) from structural ones (showing up only when a change reshapes something). Pass --json if you want structured output for scripts or tools.

Any projection whose extractor executes repository code (including some built-ins that invoke your toolchain) is listed in the output but skipped until you pass --trust. Review what those extractors run before trusting them.

Step 3: Adopt the useful ones

Once you've decided which projections are worth keeping, adopt them by ID:

projections adopt prisma-schema workspace-dependencies

Adopting writes each projection's definition into .github/projections/ and bookmarks the pull requests where it showed the most change, so your team can revisit them later with projections bookmark run. It never overwrites existing files, and you can commit the definitions whenever you're ready.

To inspect an adopted projection interactively in the Projections viewer, run:

projections view show -p workspace-dependencies --choice branch --open

Passing --open launches the viewer in your system browser. When a coding agent drives the viewer, omit --open so it can open the printed URL in its in-app browser (or in the Copilot canvas if you've installed it). You can also view a saved bookmark with --choice bookmark:<bookmark>—run projections bookmark list to see the bookmarks adopt created.

Built-in projections cover systems that most repositories share—workflows, schemas, and dependencies. For the systems specific to your codebase, like its registries, extension points, protocols, and pipelines, you'll want dedicated projections, usually with custom renderers built on the renderer kit. Head to Build your first projection, where a coding agent writes an extractor and renderer tailored to your codebase and shows you the result in the viewer.

Step 4: Add to CI

Adding the Projections GitHub Action runs your adopted projections on every pull request and push. Because the best place for that step depends on how your workflows are structured—usually inside the job that already installs dependencies and builds, so nothing gets installed twice—you can let your coding agent read your workflows, suggest where it belongs, and show you the diff before editing anything:

Add Projections to this repository's CI: run `projections help agents ci` and follow what it prints.

Commit the workflow change and open a pull request. Once the run finishes, the job summary explains step by step how the pull request reshapes your systems and uploads the projection documents as an artifact. For placement tips, reviewing results, permissions, trust, and snapshots, see Add Projections to CI.

Alternate path: the VS Code extension

If you'd rather work directly beside your code in an editor, the Projections VS Code extension provides an alternate workflow inside VS Code. It isn't on the Visual Studio Marketplace yet; instead, each GitHub release attaches a per-platform .vsix, projections-vscode-<version>-<platform>.vsix, which bundles the projections CLI (see which file to download). Install it via Extensions: Install from VSIX… in the Command Palette (⇧⌘P / Ctrl+Shift+P), or run code --install-extension <file>.vsix. To build it from source, follow the extension's README.

Once it's installed, open your repository in VS Code:

  • Run Projections: Explore Repository from the Command Palette to browse the sweep as a visual grid, inspect any pull request cell, and check Adopt (or run Projections: Adopt…). Projections that run repository code wait for VS Code's Workspace Trust.
  • Click any projection in the Projections side bar to open it in a tab that updates alongside your uncommitted edits.
  • Use Add to CI… in the Explore view (or Projections: Add to CI…) to pass the CI prompt to your agent, and Projections: Open Artifact… to inspect a downloaded CI artifact.