When no token is found via --token/env/gh CLI, the script now opens
github.com/settings/tokens/new pre-scoped to read:packages with clear
instructions on Note/Expiration/Scopes, falling back to printing the
URL when a browser can't be launched (SSH, containers, CI). Add
--no-open to skip the launch attempt outright.
Also document the flow in README (new 'Generating a GitHub token'
section) and QUICKSTART troubleshooting, and add a hermetic test
covering the --no-open + piped-token path.
Root-caused live: declaring the agent-plugins.org $schema in plugin.json
opts Copilot CLI into Open Plugin Spec mode, under which the flat
agents/skills fields are silently ignored (0 loaded, no error). Combined
with the pre-existing nested extensions.com.github.copilot.* structure
(also not a real field), the installed plugin contributed zero agents and
zero skills to any consuming project — only this repo's own working copy
worked, because Copilot CLI separately auto-loads .github/agents and
.github/skills for the current git root regardless of any plugin.
Fix: drop $schema entirely, use flat top-level agents/skills/mcpServers
fields (matches the documented, non-spec plugin.json schema). Updated
validate.mjs to error on $schema/extensions instead of recommending them,
and to check the real agents/skills path fields.
scripts/setup-npm-registry.mjs configures npm to pull @redsentech
packages (e.g. @redsentech/lean-harness) from GitHub Packages:
- Discovers a token: --token flag > env (NPM_REGISTRY_TOKEN/
GITHUB_TOKEN/GH_TOKEN) > `gh auth token` > interactive masked prompt
(raw-mode stdin, no echo, no external deps).
- Verifies the token against the GitHub API, reports the authenticated
login, and warns if the OAuth scopes are missing read:packages/
write:packages.
- Writes/updates only its own two lines in .npmrc (scope registry +
auth token), preserving every other line; idempotent on rerun.
- Never prints the full token (masked in all output).
- --dry-run, --unset (clean removal), --local, --scope, --registry,
--skip-verify, --npmrc <path> flags.
- Confirms the result with `npm whoami --registry ...`.
Verified live end-to-end: real GitHub PAT via `gh auth token` ->
verified against api.github.com -> written to a scratch .npmrc ->
`npm whoami` succeeded. Also confirmed the scope-warning is accurate:
installing @redsentech/lean-harness with a token lacking read:packages
correctly 403s, exactly as the script warns it will.
Adds tests/setup-npm-registry.test.mjs (7 hermetic tests: dry-run,
write+preserve, token never printed, idempotent rerun, --unset,
custom scope/registry, clean failure with no token). Adds
"setup-npm-registry" npm script. Documents the script in README (The
`lh` CLI section) and docs/QUICKSTART.md (install + troubleshooting).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- scripts/onboard.mjs: bootstraps a target repo onto the harness — copies
the behaviour layer (.github/agents, skills, instructions, prompts,
mcp.json, copilot-instructions.md, AGENTS.md), npm links the `lh` CLI,
runs `lh init` + `lh doctor`, prints next steps. Idempotent: identical
files are skipped, differing files require --force, re-running `lh init`
on an initialized repo warns instead of failing. Supports --dry-run and
--no-npm-link for CI/sandboxed use.
- tests/onboard.test.mjs: 5 new e2e tests (dry-run, full run, idempotent
rerun, missing target dir, conflict + --force).
- README: new "Onboarding a new project" section, full lh flag reference
for every subcommand (previously only one-line summaries), Development
section mentions the onboarding script.
Live-tested against ~/Sources/ralph-runtime (a real, not-yet-git-tracked
project): git init, .github/ copied, `npm link` succeeded, `lh init`
ran, `lh doctor` correctly flagged its one real gap (no verify command
configured) rather than a false pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Recovered from crashed session (Node OOM). Repo contains full P0-P6
scaffold: plugin.json/marketplace.json, AGENTS.md, ADRs 0001-0006,
lh CLI (init/index/graph/lane/run/memory/host/report/doctor), 10
.github/agents, 12 CLI skills, instructions, context7 mcp.json, and
unit/e2e test suite.
Fixed: run.mjs read --in-tokens/--out-tokens but tests and CLI docs
use --input-tokens/--output-tokens, so telemetry totals were always 0.
Now accepts both forms.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>