install-workflow
Install one workflow from the upstream githubnext/agentics catalog into the current repo, end to end: fetch, configure auth, commit, verify.
Flow
- If the user didn't name a workflow, pitch
daily-repo-statusas the recommended starter — it creates a daily GitHub issue summarizing repo activity, needs only read + issue-create permissions, and gives visible value on the first run. Offer to proceed with it, or run/discover-workflowsfor the full catalog. Otherwise, treat the name as a workflow ingithubnext/agentics/workflows/—gh aw add <workflow>in Step 4 will fail cleanly if the name doesn't resolve. - Check prerequisites:
ghCLI authenticated (gh auth status)gh awextension installed (gh extension list | grep gh-aw)- Write access to the repo (
gh repo view --json viewerPermission) workflowscope present on theghtoken — check viagh auth status -t 2>&1 | grep -i 'token scopes'or inspect the scopes line. Without it, the user's firstgit pushof the generated.lock.ymlwill fail with "refusing to allow an OAuth App to create or update workflow ... withoutworkflowscope". If missing, have the user rungh auth refresh -s workflow -h github.com(one-line fix, opens a browser auth flow for the scope bump) before proceeding.
Surface missing pieces plainly; don't try to install tools on the user's behalf.
- Pick auth path and set the secret — see
auth.md. Ask once: subscription or API key? Before asking, checkgh secret list— if the matching secret already exists, skip the setup and use it. Otherwise, for OAuth path guide the user throughclaude setup-token+gh secret set CLAUDE_CODE_OAUTH_TOKEN; for API-key path,gh secret set ANTHROPIC_API_KEY. - Run
gh aw add <workflow>— fetches source and compiles the.lock.yml. The name must be fully qualified asgithubnext/agentics/<workflow>(bare names fail with "invalid workflow specification"). - Inspect the fetched
.mdfor anengine:field. Upstream agentics workflows that omitengine:default to thecopilotengine — which ignores the Claude secret and won't use your auth. If missing, addengine: claudeto the frontmatter and rungh aw compile <workflow>to regenerate the.lock.yml. - If OAuth path: apply the post-compile tweak from
auth.mdStep 3 (two-pass sed — never skip the--exclude-envcarve-out). Verify with the grep counts inauth.mdStep 4. - Run
gh aw validate(safe — does not recompile). - Summarize what changed (files added, secret set or reused, engine fix applied if needed, tweak applied if applicable). Remind:
gh aw compilereverts the tweak — re-apply on every recompile.
Hard rules
- Never write workflow YAML by hand. Always delegate to
gh aw add. Ifgh awcan't produce the result, the workflow isn't in the upstream catalog. - Never commit or push without explicit user confirmation. Workflows run on push — users must opt in deliberately.
- Never store or echo the user's auth token. Hand the user a
gh secret setcommand to run themselves, or useghto set it via stdin without echoing. - When applying the OAuth tweak, never skip the
--exclude-env ANTHROPIC_API_KEYcarve-out. The blanket sed-replace strips the token from the sandbox and breaks auth ("Not logged in"). Seeauth.mdfor the two-pass pattern. - Never run
gh aw compilesilently after the tweak is applied; it reverts the tweak. If recompilation is needed, re-apply Step 5 from the flow before committing.
Out of scope for v0.1
- Uninstalling workflows
- Updating installed workflows
- Installing into repos other than the current working directory