Repository navigation
feat(agent-gh): install agent-gh from nothing on Linux and Windows - #29
Conversation
scripts/install.sh (Linux, WSL) and scripts/install.ps1 (Windows, PowerShell 7) check the prerequisites, clone the repository unless they run from a checkout, install the root package, run pnpm sync:context, save the token after GitHub confirms it belongs to the machine account, and check the result with agent-gh. A rerun keeps a working token unless the user confirms its replacement. Windows stays native: sync:context already installs the PowerShell agent-gh there, so the installer reuses its token writer and ACL check and narrows the file to the current user with icacls. The machine account is wolfstarbot, not wolfstar-agent-beep. WOLFSTAR_AGENT_GITHUB_LOGIN renames it for the installers and the agent-gh --help text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016cicF66aPJp69wLpfGRPJS
Architecture Inside the changed components — 1 viewComponent view — Bootstrap Installers Installer scripts validating tokens with GitHub API and configuring agent-gh
Data flow Review 2 findings · reviewed
|
|
Agent note: these checks were run by hand, because CI cannot cover them.
Generated by Claude Code |
|
Agent note: the failing
The build log is only on the Cloudflare dashboard, which I cannot open from here. Someone with access to the Generated by Claude Code |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
… tests The Windows checkout carries CRLF line endings, and pwsh creates AppData under the temporary home there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016cicF66aPJp69wLpfGRPJS
…gh call Install-Workspace ran pnpm in the current directory, so a script started from its download folder installed and synced nothing. It now runs pnpm inside the checkout. Dot-sourcing github-public.ps1 replaced install.ps1's own Invoke-AgentGh with the wrapper's, so the final checks called the wrong function. It is now Invoke-InstalledAgentGh, and a test refuses any shared function name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016cicF66aPJp69wLpfGRPJS
|
Agent note: both PR Lens findings on
Both new tests fail on the previous Generated by Claude Code |
🔗 Linked issue
No linked issue.
❓ Type of change
📚 Description
Setting up
agent-ghon a new machine took several manual steps: clone, pnpm,pnpm sync:context, then a token file with the right permissions. The docs also named an account that does not exist,wolfstar-agent-beep. The real machine account iswolfstarbot.This adds one installer per platform:
scripts/install.shfor Linux and Ubuntu in WSL.scripts/install.ps1for Windows in PowerShell 7.Each one checks the prerequisites, clones the repository unless it runs from a checkout, activates the pnpm version from
packageManagerthrough Corepack, runspnpm installfor the root package andpnpm sync:context, then saves the token. The token comes from a hidden prompt orWOLFSTAR_AGENT_GITHUB_TOKEN. It is saved only afterGET /userreturnswolfstarbot. The run ends withagent-gh api user --jq .loginandagent-gh api rate_limit, and prints the login, remaining quota, and binary path. Both take a dry run,--skip-clone,--dir, and--replace-token(-DryRun,-SkipClone,-Directory,-ReplaceTokenon Windows).Windows stays native, without WSL.
pnpm sync:contextalready routes toscripts/sync-agent-context.ps1on Windows, which installs the PowerShellagent-ghfrom #26. Soinstall.ps1delegates nothing to WSL. It dot-sourcesscripts/github-public.ps1and reuses its token path, token writer, and ACL check. The writer sets an owner-only ACL before any byte is written.icaclsthen removes inheritance,SYSTEM, andAdministrators, so only the current user keeps access.agent-ghaccepts that subset.Other choices a reviewer may want to question:
pnpm install --frozen-lockfile --filter wolfstar-agent-kit, as the Windows CI job does.agent-ghneeds no workspace package, and those need native toolchains.engines.nodeinpackages/wolfstar-github-agent/package.jsonand CI.--experimental-strip-typesalone needs 22.6.scripts/install.test.tskeeps both scripts equal to the engines field.jqis now a listed prerequisite on Linux. A clean Ubuntu container showed thatpnpm sync:contextfails without it, becausescripts/agent-context-hooks.shreads the hook list withjq.corepack install --globalpins pnpm 11.22.0 outside the checkout too. Without it, the Corepack shim ran pnpm 12 outside the repository.WOLFSTAR_AGENT_GITHUB_LOGIN(defaultwolfstarbot) sets the login the installers expect and the name inagent-gh --help. The account was never compared in code, only printed.Invoke-RestMethodin process. It is never an argument, and it leaves the environment before any child process starts.WOLFSTAR_AGENT_GITHUB_APIpoints the token check at a stand-in server for tests.agent-ghitself still talks only to github.com.pnpm sync:contexton Linux. It also writes~/.claude/CLAUDE.mdand~/.codex/AGENTS.md, installs the hooks, and sets the global gitcore.hooksPath. The installer says so before it runs the command.scripts/install.test.tsruns on the Linux and Windows CI jobs. On Windows it checks the realicaclsresult: one allow rule for the current user, with inheritance removed.Still to check by hand:
install.ps1run on a real Windows machine: clone, Corepack fallback to~\.local\binwhen Node lives in Program Files,-AddToPath, and the hidden prompt. CI covers the token functions and the ACL, not the whole run.wolfstarbot. My checks used a stand-in forGET /userandgh, because this session has no token. I could not confirm from here that the account exists./mnt/cwarning was only simulated withWSL_DISTRO_NAME.Generated by Claude Code