feat: bare insta login signs in from the browser - #156
Conversation
Bare `insta login` used to die with "--email is required" — yet the
console quick-start prints it as the login step ("sign in when the
browser opens"), and OAuth-signup accounts have no password to type
anyway. It now rides the existing device grant and opens the console
approval page locally: sign in there with whatever the account uses
(email, GitHub, Google), check the code, approve, done. --device keeps
the print-only link for machines without a usable browser; --email,
--oauth, and --api-key are unchanged.
`setup agent` flows into the same browser login instead of hardcoding
GitHub OAuth, which dead-ended Google/email accounts at its prompt.
There was a problem hiding this comment.
All reported issues were addressed across 7 files
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
jwfing
left a comment
There was a problem hiding this comment.
Summary
Bare browser login is implemented in the expected place, but the PR misses a required command-reference update.
Requirements context
I used the PR title/description as the behavioral intent: bare insta login should launch the browser-backed device approval flow, --device should stay print-only, and setup agent should no longer hardcode GitHub OAuth. I also used the repo guidance in AGENTS.md, which explicitly requires command/flag changes to be mirrored in skills/insta/cli-reference.md, and the README’s pointer to that file as the full command reference.
Findings
Critical
AGENTS.md:16-17,src/index.ts:64-68,README.md:193-198: This changes the publicinsta logincommand contract, but the required agent-facing referenceskills/insta/cli-reference.mdis not updated in this change. That file is called out as non-negotiable for command/flag changes, and agents using the documented full reference may keep learning the old GitHub-first login behavior. Please update the CLI reference in the matching superproject skills submodule/change set.
Suggestion
src/api.ts:127-129,src/commands/env.ts:70-74: Two runtime hints still tell unauthenticated users to runinsta login --oauth github. Since this PR’s stated goal is to make bareinsta loginthe account-type-neutral path, these should probably move toinsta loginas well.src/commands/auth.ts:27-32,test/device-login.test.ts:145-170: The new opener behavior is covered atdeviceGrant, but there is no direct test that top-levellogin({})dispatches to the opener-backed device flow, or that--password/$INSTA_PASSWORDwithout--emailtakes the new error branch. Consider adding a thin dispatch-level test so this public default does not regress silently.
Information
- Software engineering: The implementation follows the existing DI style for side-effectful flows, and
git diff --check main...HEADis clean. I did not runnpm run typecheckornpm testbecausenode_modulesis absent and this review is read-only, so installing dependencies was out of scope. - Security: No security-relevant issue found. The new local browser launch uses the existing
openUrlpath, which gates to HTTP(S) before spawning (src/util.ts:36-51), and the device flow still prints the user-code verification step (src/commands/auth.ts:138-150). - Performance: No performance issue found. The polling loop retains the bounded lifetime and interval/backoff behavior (
src/commands/auth.ts:137-157,src/commands/auth.ts:168-170).
Verdict
Request changes due to the missing required CLI reference update.
…atch tests An explicitly empty --email now errors instead of falling into the bare browser flow (cubic). The two runtime hints that still said `insta login --oauth github` (api.ts 401 hint, env.ts post-switch hint) now recommend bare `insta login`, matching the account-type-neutral default (review suggestion). New login-dispatch tests pin the public default — bare login = device grant + local opener, --device print-only — and the password/empty-email guard branches, via an injectable device runner.
jwfing
left a comment
There was a problem hiding this comment.
Summary
Bare insta login is implemented through the existing device grant with a local opener, but the required CLI reference mirror is missing/stale.
Requirements Context
I based the intended behavior on the PR title/description, the updated README authentication docs (README.md:61-93, README.md:191-198), and the repo requirements in AGENTS.md:15-17 plus .claude/skills/developing-insta-cli/SKILL.md:36-38. I did not see a linked issue in the provided PR metadata. I also checked the README-linked command reference, which currently still documents only explicit email/OAuth/device login forms: https://github.com/InsForge/insta-skills/blob/main/insta/cli-reference.md#L7-L8
Findings
Critical
AGENTS.md:15-17,.claude/skills/developing-insta-cli/SKILL.md:36-38: This PR changes thelogincommand surface and help text (src/commands/auth.ts:26-35,src/index.ts:64-68) but does not include the required mirror update toskills/insta/cli-reference.md. The README points users/agents to that full reference atREADME.md:193-194, and the current linked reference remains stale for bareinsta loginand the new--devicedistinction. Because that mirror is explicitly non-negotiable and agent-facing, this should be fixed before merge.
Suggestion
- (none)
Information
- Software engineering/functionality: The implementation follows the repo’s DI testing pattern and adds focused coverage for bare-login dispatch, opener invocation, printed fallback link, expiry hint wording, empty
--email, password-without-email, and the setup-agent prompt (test/login-dispatch.test.ts:28-70,test/device-login.test.ts:145-169,test/setup-agent.test.ts:143-154). - Security: No security-relevant changes found. The new opener path still goes through the existing HTTP(S)-only launcher guard (
src/util.ts:36-45), and the device flow continues to print the user-code verification guard (src/commands/auth.ts:141-153). - Performance: No performance-relevant changes found. The device polling loop keeps the existing bounded lifetime and
slow_downbackoff behavior (src/commands/auth.ts:156-182). - Verification note:
git diff --check main...HEADpassed.npm run typecheckcould not run in this checkout becausenode_modulesis absent andtscwas not found; I did not runnpm testfor the same missing dependency reason (package.json:35-40).
Verdict
Request changes until the required skills/insta/cli-reference.md mirror is updated for bare browser login and print-only --device semantics.
What
Bare
insta loginnow signs you in from the browser instead of dying with--email is required. It rides the existing RFC 8628 device grant and additionally opens the console approval page locally — sign in there with whatever the account uses (email, GitHub, Google), check the code, approve.setup agentflows into this same login instead of hardcoding--oauth github, which dead-ended Google/email accounts.This makes the console Quick Start's Login step (
insta login+ "sign in when the browser opens",insta-frontendsrc/lib/agent-setup.tsloginCommand) true as printed — no console change needed. Same shape asinsforge login: browser session present → approve for that account; none → the page's/signin?next=…round-trip first.How
commands/auth.ts—login()bare branch callsloginDevice(opts, openUrl)instead ofdie; a password (--password/$INSTA_PASSWORD) without--emailstill errors, now saying so.deviceGranttakes an optionalopenlauncher: when present it opens the verification link and still prints it (spawn launch failures are async-only, same reasoning asbrowserOauth); the expiry retry hint names the flow that ran (insta loginvsinsta login --device).commands/setup.ts—loginFlow.login=loginDevice({}, openUrl); prompt copy "log in now in the browser? (Y/n)"; the failed-login hint no longer claims the browser flow can't work remotely (the printed link works from any device).index.ts— help text: bare = browser sign-in;--device= same, print-only for other machines.--email,--oauth github|google,--device,--api-keybehavior unchanged.install.shnext-steps hint now lead with bareinsta login.Verify
npm run typecheck && npm test— 657/657 green (new: opener launched at the verification link and link still printed; expiry hint per flow;--devicehint pinned).dist/against prod: bareinsta loginprints "opening your browser to sign in…" + theconsole.instacloud.com/device?user_code=…fallback link and polls;insta login --deviceunchanged (print-only);insta login --password xerrors with the--emailhint;login --helpshows the new synopsis.Summary by cubic
Bare
insta loginnow opens your browser to sign in from the console approval page instead of failing with--email is required.setup agentuses this same browser login instead of hardcoding--oauth github, which dead-ended Google and email accounts.--devicekeeps the print-only link for machines without a usable browser.--passwordwithout--emailstill errors, now with a message saying so; an explicitly empty--emailerrors too instead of falling through to the bare browser flow.insta loginvsinsta login --device).install.sh, and the not-logged-in and env-switch hints now lead with bareinsta login.Written for commit 6b899f0. Summary will update on new commits.