@dccxx/auggiegw
v1.0.32
Published
A Node.js TypeScript package
Readme
@dccxx/auggiegw
A CLI tool for managing Augment Gateway authentication, proxy configuration, and custom prompts. This tool simplifies the workflow of authenticating with Augment Gateway, fetching proxy configurations, and managing custom prompts for the Augment AI assistant.
Features
- 🔐 Authentication Management: Login/logout with secure credential storage
- 🌐 Proxy Configuration: Automatic proxy setup and authentication
- 📝 Custom Prompts: Fetch and save custom prompts to
~/.augment/commands/ - 🔄 Auggie Integration: Seamlessly forward commands to the Auggie CLI
- ⚡ Command Execution: Execute any command with automatic session setup
- 🔀 Account Switching: Automatically switch between purchased accounts
Installation
npm install -g @dccxx/auggiegwor with Bun:
bun install -g @dccxx/auggiegwQuick Start
Login to Augment Gateway:
auggiegw loginYou'll be prompted for your username and password.
Fetch Configuration:
auggiegw fetchThis fetches proxy configuration, authenticates, and downloads custom prompts.
Global Options
The following options can be used with any command that triggers session management (fetch, auggie, exec):
--preserve-session: Preserve Auggie session and chat history when switching accounts--delete-session: Explicitly delete Auggie session and chat history (default behavior)
Examples:
# Preserve chat history when fetching
auggiegw --preserve-session fetch
# Preserve chat history when running auggie
auggiegw --preserve-session auggie --help
# Explicitly delete session (same as default)
auggiegw --delete-session fetchPrecedence Order (highest to lowest):
- Command-line flags (
--preserve-sessionor--delete-session) - Environment variable (
AUGGIEGW_DELETE_SESSION) - Default behavior (delete session)
Commands
auggiegw login [username] [password]
Login and store credentials securely.
Interactive Mode (Recommended):
auggiegw loginYou'll be prompted to enter your username and password. The password input is hidden for security.
Direct Mode:
auggiegw login myusername mypasswordWhat it does:
- Authenticates with the Augment Gateway API
- Stores credentials in
~/.auggiegw/auth.json - Token is used for subsequent commands
auggiegw logout
Logout and remove stored credentials.
auggiegw logoutWhat it does:
- Deletes the authentication file (
~/.auggiegw/auth.json) - Removes stored credentials from your system
auggiegw fetch
Fetch proxy configuration, authenticate, and download custom prompts.
Basic Usage:
auggiegw fetchWith Session Control:
# Preserve chat history
auggiegw --preserve-session fetch
# Explicitly delete session (default)
auggiegw --delete-session fetchWhat it does:
- Retrieves proxy configuration from Augment Gateway
- Authenticates the proxy
- Saves Augment session to
~/.augment/session.json - Deletes Auggie session (unless
--preserve-sessionis used) - Fetches all custom prompts from the server
- Saves prompts as markdown files in
~/.augment/commands/
Output Example:
✔ Successfully saved 15 promptsauggiegw auggie [args...]
Forward commands to the Auggie CLI with automatic configuration.
Basic Usage:
auggiegw auggie [auggie-arguments]Examples:
# Run Auggie with help
auggiegw auggie --help
# Run Auggie and preserve chat history
auggiegw --preserve-session auggie
# Run Auggie with a specific prompt
auggiegw --preserve-session auggie --print "Hello, world!"What it does:
- Runs
auggiegw fetchto ensure configuration is up-to-date - Deletes Auggie session (unless
--preserve-sessionis used) - Forwards all arguments to the
auggiecommand - Inherits stdio for interactive sessions
auggiegw exec <command> [args...]
Execute any custom command with automatic session setup.
Basic Usage:
auggiegw exec <command> [arguments]Examples:
# Execute auggie with help
auggiegw exec auggie --help
# Execute with preserved session
auggiegw --preserve-session exec auggie --help
# Execute custom command
auggiegw --preserve-session exec node script.jsWhat it does:
- Runs
auggiegw fetchto ensure configuration is up-to-date - Deletes Auggie session (unless
--preserve-sessionis used) - Executes the specified command with provided arguments
- Inherits stdio for interactive sessions
auggiegw switch-account
Automatically switch to a newer account from your purchased account list.
Basic Usage:
auggiegw switch-accountWhat it does:
- Fetches the list of purchased accounts from the API
- Identifies the current account (status "in-use")
- Switches to the next newer account (the account before the current one in the descending list)
- Activates the new account via the API
- Refreshes authentication with the new account (auth only, skips prompts)
Example Output:
✔ Successfully switched to account: [email protected]
Refreshing authentication...
✔ Authentication successful (prompts skipped)Notes:
- The account list is sorted by purchase date in descending order (newest first)
- The command will fail if there are no newer accounts available
- After switching, the authentication session is automatically refreshed
- The old session is preserved - chat history and session data are not deleted when switching accounts
- Custom prompts are not re-fetched during the switch (use
auggiegw fetchif needed)
Authentication Methods
Method 1: Login Command (Recommended for Local Development)
auggiegw loginCredentials are stored in ~/.auggiegw/auth.json and automatically used for subsequent commands.
Method 2: Environment Variable (Recommended for CI/CD)
Set the AUGGIEGW_AUTH_TOKEN environment variable:
export AUGGIEGW_AUTH_TOKEN=your_token_hereWhen this environment variable is set, the CLI uses it directly without requiring the login command or auth.json file.
Example in CI/CD:
# GitHub Actions example
env:
AUGGIEGW_AUTH_TOKEN: ${{ secrets.AUGGIEGW_AUTH_TOKEN }}Configuration
Session Management
The CLI provides multiple ways to control session deletion behavior when switching accounts:
1. Command-Line Flags (Highest Priority)
Use global options with any command:
# Preserve session for a single command
auggiegw --preserve-session fetch
# Explicitly delete session (default behavior)
auggiegw --delete-session fetch2. Environment Variable
Set AUGGIEGW_DELETE_SESSION to control default behavior:
# Preserve sessions by default
export AUGGIEGW_DELETE_SESSION=false
auggiegw fetch
# Delete sessions by default (same as built-in default)
export AUGGIEGW_DELETE_SESSION=true
auggiegw fetch3. Default Behavior (Lowest Priority)
By default, the CLI deletes the Auggie session (including chat history) when fetching configuration to ensure a clean state for each account.
Precedence Order:
- Command-line flags (
--preserve-sessionor--delete-session) - Always takes precedence - Environment variable (
AUGGIEGW_DELETE_SESSION) - Used if no CLI flag is provided - Default behavior (delete session) - Used if neither flag nor environment variable is set
Examples:
# CLI flag overrides environment variable
export AUGGIEGW_DELETE_SESSION=false
auggiegw --delete-session fetch # Session WILL be deleted
# Environment variable is used when no flag is provided
export AUGGIEGW_DELETE_SESSION=false
auggiegw fetch # Session will NOT be deleted
# Default behavior when nothing is set
unset AUGGIEGW_DELETE_SESSION
auggiegw fetch # Session WILL be deleted (default)Environment Variables
AUGGIEGW_AUTH_TOKEN: Authentication token for API access (alternative to login command)AUGGIEGW_DELETE_SESSION: Control Auggie session deletion behavior- Set to
falseto preserve chat history when switching accounts - Set to
trueor leave unset for default behavior (delete session) - Can be overridden by command-line flags
- Set to
File Locations
- Auth Data:
~/.auggiegw/auth.json - Augment Session:
~/.augment/session.json - Custom Prompts:
~/.augment/commands/*.md
Custom Prompts
Custom prompts are fetched from the Augment Gateway and saved as markdown files in ~/.augment/commands/. Each prompt file follows this format:
---
description: Prompt Name
---
Prompt content goes here...The filename corresponds to the command name (e.g., my-command.md).
Usage Examples
Switching Accounts with Preserved Chat History
# Method 1: Using command-line flag
auggiegw login user1
auggiegw --preserve-session fetch
auggiegw --preserve-session auggie
# Switch to another account
auggiegw login user2
auggiegw --preserve-session fetch
auggiegw --preserve-session auggieSwitching Accounts with Clean Sessions (Default)
# Default behavior - session is deleted
auggiegw login user1
auggiegw fetch
auggiegw auggie
# Switch to another account - previous session is cleared
auggiegw login user2
auggiegw fetch
auggiegw auggieUsing Environment Variable for Multiple Commands
# Set environment variable once
export AUGGIEGW_DELETE_SESSION=false
# All subsequent commands preserve session
auggiegw login user1
auggiegw fetch
auggiegw auggie
# Switch accounts without losing history
auggiegw login user2
auggiegw fetch
auggiegw auggieOverride Environment Variable with CLI Flag
# Set default to preserve
export AUGGIEGW_DELETE_SESSION=false
# This preserves session (follows env var)
auggiegw fetch
# This deletes session (CLI flag overrides env var)
auggiegw --delete-session fetchCI/CD Pipeline Example
# GitHub Actions workflow
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Setup authentication
env:
AUGGIEGW_AUTH_TOKEN: ${{ secrets.AUGGIEGW_AUTH_TOKEN }}
AUGGIEGW_DELETE_SESSION: true
run: |
auggiegw fetch
auggiegw exec npm run deployRequirements
- Node.js: >= 18.0.0
- Bun: For package management and running scripts (development)
- Auggie CLI: Required for
auggiegw auggiecommand
Troubleshooting
"Not logged in" Error
Error: Not logged in. Please run "auggiegw login" first.Solution: Run auggiegw login to authenticate.
"Failed to get proxy" Error
Possible causes:
- Invalid credentials
- Network connectivity issues
- API endpoint unavailable
Solution:
- Verify your credentials with
auggiegw logoutthenauggiegw login - Check your network connection
- Verify the API URL is correct
"No proxy data available" Error
Solution: Contact your administrator to ensure your account has proxy access configured.
Chat History Lost When Switching Accounts
By default, the CLI deletes the Auggie session (including chat history) when fetching configuration. This ensures a clean state for each account.
Solution 1: Use Command-Line Flag (Recommended)
Preserve session for specific commands:
# Login to new account
auggiegw login newuser
# Fetch with preserved session
auggiegw --preserve-session fetch
# Or use with auggie command
auggiegw --preserve-session auggieSolution 2: Use Environment Variable
Set a persistent default behavior:
# Set the environment variable to disable session deletion
export AUGGIEGW_DELETE_SESSION=false
# Then run your commands as usual
auggiegw login newuser
auggiegw fetchSolution 3: Mixed Approach
Combine both methods for flexibility:
# Set default to preserve
export AUGGIEGW_DELETE_SESSION=false
# Most commands will preserve session
auggiegw fetch
# But you can override for specific commands
auggiegw --delete-session fetch # This will delete the sessionNote: Disabling session deletion may cause conflicts if different accounts have incompatible session data. Use this option only if you need to preserve chat history across account switches.
License
See LICENSE file for details.
Support
For issues and questions, please open an issue on the GitHub repository.
