Skip to content

feat(login): add github auth and plugin install for init#21

Merged
rhuanbarreto merged 8 commits into
mainfrom
claude/sweet-cohen
Feb 28, 2026
Merged

feat(login): add github auth and plugin install for init#21
rhuanbarreto merged 8 commits into
mainfrom
claude/sweet-cohen

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Adds archgate login command with GitHub OAuth device flow (RFC 8628) for CLI authentication
  • Exchanges GitHub token for an archgate plugin token via POST /api/token/claim on the plugins service
  • Stores credentials locally in ~/.archgate/credentials
  • Enhances archgate init to auto-detect credentials and configure plugin access:
    • Claude Code: prints the authenticated marketplace URL for /plugin marketplace add
    • Cursor: downloads and extracts the cursor.tar.gz plugin bundle directly

New commands

Command Description
archgate login Authenticate with GitHub via device flow
archgate login status Show current auth status
archgate login logout Remove stored credentials
archgate login refresh Re-authenticate and claim a new token

New files

File Purpose
src/helpers/auth.ts Device flow, token claim, credential storage
src/helpers/plugin-install.ts Marketplace URL builder, Cursor bundle download
src/commands/login.ts Login command with status/logout/refresh subcommands
tests/helpers/auth.test.ts 14 tests for auth helper
tests/commands/login.test.ts 5 tests for command registration
tests/helpers/plugin-install.test.ts 2 tests for URL builder

Test plan

  • All 19 new tests pass (bun test tests/helpers/auth.test.ts tests/commands/login.test.ts tests/helpers/plugin-install.test.ts)
  • Existing init tests still pass (11/11)
  • Lint: 0 errors (3 expected no-await-in-loop warnings for RFC 8628 polling)
  • Typecheck: clean
  • Format: clean
  • Build: compiles successfully
  • End-to-end: run archgate login against live plugins service
  • End-to-end: run archgate init --install-plugin with stored credentials

🤖 Generated with Claude Code

@rhuanbarreto rhuanbarreto force-pushed the claude/sweet-cohen branch 2 times, most recently from feba61c to 538a8bd Compare February 28, 2026 01:42
rhuanbarreto and others added 2 commits February 28, 2026 02:45
Add `archgate login` command that authenticates users via GitHub's
OAuth device flow (RFC 8628) and exchanges the GitHub token for an
archgate plugin token via the plugins service. Tokens are stored
locally in ~/.archgate/credentials.

The `init` command now auto-detects stored credentials and:
- For Claude Code: prints the marketplace URL with embedded token
- For Cursor: downloads and extracts the cursor plugin bundle

New files:
- src/helpers/auth.ts — device flow, token claim, credential storage
- src/helpers/plugin-install.ts — marketplace URL builder, cursor download
- src/commands/login.ts — login/logout/status/refresh subcommands
- tests/ — 19 new tests covering auth, login, and plugin-install

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace shell commands (mkdir -p, rm -f) with mkdirSync/unlinkSync from
node:fs in plugin-install.ts. Use static import for unlinkSync in auth.ts
instead of dynamic import. tar is available on macOS, Linux, and Windows 10+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rhuanbarreto rhuanbarreto changed the title feat(login): GitHub auth and plugin install for init feat(login): add github auth and plugin install for init Feb 28, 2026
rhuanbarreto and others added 6 commits February 28, 2026 03:21
Use `claude plugin marketplace add` and `claude plugin install` to
automatically install the archgate plugin when the claude CLI is on
PATH. Falls back to printing manual commands when the CLI is not found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrite quick start to include login step and editor flag. Add archgate
login command docs. Replace old claude-code-plugin GitHub link with
plugins.archgate.dev. Add dedicated Claude Code and Cursor plugin
sections with install instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Emphasize that the CLI is free and fully functional without plugins or
an account. Move login out of quick start since it is only needed for
the optional paid editor plugins. Add callouts throughout the README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rhuanbarreto rhuanbarreto merged commit ed03063 into main Feb 28, 2026
2 checks passed
@archgatebot archgatebot Bot mentioned this pull request Feb 28, 2026
rhuanbarreto added a commit that referenced this pull request Feb 28, 2026
* feat(login): add GitHub device flow auth and plugin install for init

Add `archgate login` command that authenticates users via GitHub's
OAuth device flow (RFC 8628) and exchanges the GitHub token for an
archgate plugin token via the plugins service. Tokens are stored
locally in ~/.archgate/credentials.

The `init` command now auto-detects stored credentials and:
- For Claude Code: prints the marketplace URL with embedded token
- For Cursor: downloads and extracts the cursor plugin bundle

New files:
- src/helpers/auth.ts — device flow, token claim, credential storage
- src/helpers/plugin-install.ts — marketplace URL builder, cursor download
- src/commands/login.ts — login/logout/status/refresh subcommands
- tests/ — 19 new tests covering auth, login, and plugin-install

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use cross-platform node:fs APIs for Windows compatibility

Replace shell commands (mkdir -p, rm -f) with mkdirSync/unlinkSync from
node:fs in plugin-install.ts. Use static import for unlinkSync in auth.ts
instead of dynamic import. tar is available on macOS, Linux, and Windows 10+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(login): auto-install claude plugin via CLI when available

Use `claude plugin marketplace add` and `claude plugin install` to
automatically install the archgate plugin when the claude CLI is on
PATH. Falls back to printing manual commands when the CLI is not found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: improve init flow and plugin install documentation

Rewrite quick start to include login step and editor flag. Add archgate
login command docs. Replace old claude-code-plugin GitHub link with
plugins.archgate.dev. Add dedicated Claude Code and Cursor plugin
sections with install instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* add initialized configs for claude and cursor

* docs: clarify free CLI vs optional paid plugins

Emphasize that the CLI is free and fully functional without plugins or
an account. Move login out of quick start since it is only needed for
the optional paid editor plugins. Add callouts throughout the README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add cursor onboarding step for ag-onboard skill

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix prettier formatting in settings.local.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@rhuanbarreto rhuanbarreto deleted the claude/sweet-cohen branch March 3, 2026 22:09
rhuanbarreto added a commit that referenced this pull request Mar 3, 2026
* feat(login): add GitHub device flow auth and plugin install for init

Add `archgate login` command that authenticates users via GitHub's
OAuth device flow (RFC 8628) and exchanges the GitHub token for an
archgate plugin token via the plugins service. Tokens are stored
locally in ~/.archgate/credentials.

The `init` command now auto-detects stored credentials and:
- For Claude Code: prints the marketplace URL with embedded token
- For Cursor: downloads and extracts the cursor plugin bundle

New files:
- src/helpers/auth.ts — device flow, token claim, credential storage
- src/helpers/plugin-install.ts — marketplace URL builder, cursor download
- src/commands/login.ts — login/logout/status/refresh subcommands
- tests/ — 19 new tests covering auth, login, and plugin-install

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use cross-platform node:fs APIs for Windows compatibility

Replace shell commands (mkdir -p, rm -f) with mkdirSync/unlinkSync from
node:fs in plugin-install.ts. Use static import for unlinkSync in auth.ts
instead of dynamic import. tar is available on macOS, Linux, and Windows 10+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(login): auto-install claude plugin via CLI when available

Use `claude plugin marketplace add` and `claude plugin install` to
automatically install the archgate plugin when the claude CLI is on
PATH. Falls back to printing manual commands when the CLI is not found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: improve init flow and plugin install documentation

Rewrite quick start to include login step and editor flag. Add archgate
login command docs. Replace old claude-code-plugin GitHub link with
plugins.archgate.dev. Add dedicated Claude Code and Cursor plugin
sections with install instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* add initialized configs for claude and cursor

* docs: clarify free CLI vs optional paid plugins

Emphasize that the CLI is free and fully functional without plugins or
an account. Move login out of quick start since it is only needed for
the optional paid editor plugins. Add callouts throughout the README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add cursor onboarding step for ag-onboard skill

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix prettier formatting in settings.local.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
rhuanbarreto added a commit that referenced this pull request Mar 4, 2026
* feat(login): add GitHub device flow auth and plugin install for init

Add `archgate login` command that authenticates users via GitHub's
OAuth device flow (RFC 8628) and exchanges the GitHub token for an
archgate plugin token via the plugins service. Tokens are stored
locally in ~/.archgate/credentials.

The `init` command now auto-detects stored credentials and:
- For Claude Code: prints the marketplace URL with embedded token
- For Cursor: downloads and extracts the cursor plugin bundle

New files:
- src/helpers/auth.ts — device flow, token claim, credential storage
- src/helpers/plugin-install.ts — marketplace URL builder, cursor download
- src/commands/login.ts — login/logout/status/refresh subcommands
- tests/ — 19 new tests covering auth, login, and plugin-install

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use cross-platform node:fs APIs for Windows compatibility

Replace shell commands (mkdir -p, rm -f) with mkdirSync/unlinkSync from
node:fs in plugin-install.ts. Use static import for unlinkSync in auth.ts
instead of dynamic import. tar is available on macOS, Linux, and Windows 10+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(login): auto-install claude plugin via CLI when available

Use `claude plugin marketplace add` and `claude plugin install` to
automatically install the archgate plugin when the claude CLI is on
PATH. Falls back to printing manual commands when the CLI is not found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: improve init flow and plugin install documentation

Rewrite quick start to include login step and editor flag. Add archgate
login command docs. Replace old claude-code-plugin GitHub link with
plugins.archgate.dev. Add dedicated Claude Code and Cursor plugin
sections with install instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* add initialized configs for claude and cursor

* docs: clarify free CLI vs optional paid plugins

Emphasize that the CLI is free and fully functional without plugins or
an account. Move login out of quick start since it is only needed for
the optional paid editor plugins. Add callouts throughout the README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add cursor onboarding step for ag-onboard skill

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix prettier formatting in settings.local.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant