You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8a74960
Browse filesBrowse the repository at this point in the historyBrowse files
fix(starter): recover from missing Copilot CLI during setup (#26)
<!-- Use a conventional commit-style title, such as "fix(hub): retain
prototype history". -->
## Why
<!-- Explain the problem and why this change matters in a short,
plain-English paragraph. Link the issue when applicable. -->
When the Copilot app cannot find the `copilot` command, Replica setup
fails before installing app dependencies. Its recovery message tells
users to enable a plugin that was never installed.
## What changes
<!-- Describe what becomes different for a first-time reader. Explain
necessary terms. Include accurate Mermaid diagrams when they clarify the
proposal, using before/after diagrams when helpful. Add screenshots for
meaningful UI changes. -->
<!-- Omit validation sections, checklists, and routine test/CI summaries
such as "CI is green" or "tests passed". Mention only known verification
gaps that affect the change, not disclaimers about drafting this
description. -->
Setup installs a missing CLI globally with `npm install -g
@github/copilot`, then uses npm's installation path without changing
shell configuration or requiring a restart. Existing CLIs are left
untouched. Installation does not use sudo.
Startup always attempts `npm ci`, even when CLI installation or Replica
setup fails. Afterward, a final summary reports dependency and plugin
results, failure reasons, and recovery commands. Only dependency
installation failures fail startup; running plugin setup directly still
reports failure with a nonzero exit status. Successful plugin
installation does not claim the current session loaded the canvas.
The summary appears in setup output, not chat. Existing prototype
repositories need the updated setup script and startup configuration to
adopt this behavior. Real global installation and activation in a fresh
Copilot app session remain unverified; automated coverage uses isolated
command stand-ins.
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 672ac438-2a2b-4b12-8aac-b964632eebde
You can also run this manually in a terminal with Copilot CLI available.
52
52
53
-
If the `copilot`command is unavailable, follow the [Copilot CLI installation instructions](https://docs.github.com/en/copilot/get-started/cli-quickstart) first.
53
+
Repositories using the current Replica starter setup script automatically run `npm install -g @github/copilot`if `copilot`is missing, then install the Replica plugin. This needs npm and a writable global installation directory. Setup does not use sudo or change your shell configuration. Dependency installation with `npm ci` still runs if CLI or plugin setup fails; this does not mean the canvas is ready. Check the app's setup output for the failure reason and recovery steps. If automatic installation fails, or your repository does not use that script, follow the [Copilot CLI installation instructions](https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli), then rerun `node scripts/setup-replica-plugin.mjs` in repositories that have it.
54
54
55
55
In the Copilot app sidebar, open **Customize**, then **Installed**. Find the `replica-prototype` plugin and enable it. Also find its `replica-prototype` canvas and enable that extension; both the plugin and extension must be enabled.
Copy file name to clipboardExpand all lines: starter/README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,16 +205,20 @@ The preview's browser origin differs from the original address. Original-origin
205
205
After you review and accept the Copilot app's repository configuration,
206
206
session setup checks the Replica plugin before installing app dependencies.
207
207
An enabled installation needs one local CLI check and no network requests.
208
+
If `copilot` is missing from `PATH`, setup checks npm's global installation path and reuses an existing CLI there. Only if neither location has the CLI does setup run `npm install -g @github/copilot`. This works without a shell restart or changing `PATH`, including on later startups. Setup does not reinstall an existing CLI, use sudo, install Node.js, or change shell configuration. The npm global installation directory must be writable when installation is needed.
208
209
Setup enables a disabled marketplace installation or installs a missing one
209
210
from `github/replica`. It preserves an existing marketplace's branch or release
210
-
pin and stops on conflicting sources or CLI errors. For an organization-required
211
+
pin and stops plugin setup on conflicting sources or CLI errors. For an organization-required
211
212
pin, register the approved marketplace before setup.
212
213
213
214
Outside automatic session setup, run `node scripts/setup-replica-plugin.mjs`
214
-
manually. The script requires Node.js and Copilot CLI and uses no agent.
215
+
manually. The script requires Node.js and npm and uses no agent.
215
216
Installation commands run without interactive input and have bounded timeouts;
216
-
approval or policy failures need user action. A failed plugin check stops the
217
-
startup command before `npm ci`; resolve it and rerun setup.
217
+
approval or policy failures need user action. Session startup always attempts `npm ci`, even if CLI installation or plugin setup fails. If dependencies install successfully, startup completes without a hard error, but the Replica canvas remains unavailable until plugin setup succeeds. Dependency installation failures still fail startup.
218
+
219
+
Session startup runs `node scripts/setup-replica-plugin.mjs --startup`. After `npm ci` finishes, the script prints a final summary of dependency installation and Replica plugin setup, including failure reasons and recovery commands. Plugin installation success does not prove that the current session loaded the canvas; the summary includes the separate activation steps.
220
+
221
+
Plugin failures also print the cause and recovery guidance when they occur. Repository setup scripts have no documented way to post a chat message; agents do not automatically receive this output. Open the app's setup output to diagnose the failure, then rerun `node scripts/setup-replica-plugin.mjs` after resolving it. Running that script without `--startup` only sets up the plugin and still exits nonzero on failure.
218
222
For manual installation, updates or source changes, follow the
0 commit comments