A Node.js TypeScript package
npm install @dccxx/auggiegwA 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.
- š 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
``bash`
npm install -g @dccxx/auggiegw
or with Bun:
`bash`
bun install -g @dccxx/auggiegw
1. Login to Augment Gateway:
`bash`
auggiegw login
You'll be prompted for your username and password.
2. Fetch Configuration:
`bash`
auggiegw fetch
This fetches proxy configuration, authenticates, and downloads custom prompts.
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:
`bashPreserve chat history when fetching
auggiegw --preserve-session fetch
Precedence Order (highest to lowest):
1. Command-line flags (
--preserve-session or --delete-session)
2. Environment variable (AUGGIEGW_DELETE_SESSION)
3. Default behavior (delete session)---
Commands
$3
Login and store credentials securely.
Interactive Mode (Recommended):
`bash
auggiegw login
`
You'll be prompted to enter your username and password. The password input is hidden for security.Direct Mode:
`bash
auggiegw login myusername mypassword
`What it does:
- Authenticates with the Augment Gateway API
- Stores credentials in
~/.auggiegw/auth.json
- Token is used for subsequent commands---
$3
Logout and remove stored credentials.
`bash
auggiegw logout
`What it does:
- Deletes the authentication file (
~/.auggiegw/auth.json)
- Removes stored credentials from your system---
$3
Fetch proxy configuration, authenticate, and download custom prompts.
Basic Usage:
`bash
auggiegw fetch
`With Session Control:
`bash
Preserve chat history
auggiegw --preserve-session fetchExplicitly delete session (default)
auggiegw --delete-session fetch
`What it does:
1. Retrieves proxy configuration from Augment Gateway
2. Authenticates the proxy
3. Saves Augment session to
~/.augment/session.json
4. Deletes Auggie session (unless --preserve-session is used)
5. Fetches all custom prompts from the server
6. Saves prompts as markdown files in ~/.augment/commands/Output Example:
`
ā Successfully saved 15 prompts
`---
$3
Forward commands to the Auggie CLI with automatic configuration.
Basic Usage:
`bash
auggiegw auggie [auggie-arguments]
`Examples:
`bash
Run Auggie with help
auggiegw auggie --helpRun Auggie and preserve chat history
auggiegw --preserve-session auggieRun Auggie with a specific prompt
auggiegw --preserve-session auggie --print "Hello, world!"
`What it does:
1. Runs
auggiegw fetch to ensure configuration is up-to-date
2. Deletes Auggie session (unless --preserve-session is used)
3. Forwards all arguments to the auggie command
4. Inherits stdio for interactive sessions---
$3
Execute any custom command with automatic session setup.
Basic Usage:
`bash
auggiegw exec [arguments]
`Examples:
`bash
Execute auggie with help
auggiegw exec auggie --helpExecute with preserved session
auggiegw --preserve-session exec auggie --helpExecute custom command
auggiegw --preserve-session exec node script.js
`What it does:
1. Runs
auggiegw fetch to ensure configuration is up-to-date
2. Deletes Auggie session (unless --preserve-session is used)
3. Executes the specified command with provided arguments
4. Inherits stdio for interactive sessions---
$3
Automatically switch to a newer account from your purchased account list.
Basic Usage:
`bash
auggiegw switch-account
`What it does:
1. Fetches the list of purchased accounts from the API
2. Identifies the current account (status "in-use")
3. Switches to the next newer account (the account before the current one in the descending list)
4. Activates the new account via the API
5. Refreshes authentication with the new account (auth only, skips prompts)
Example Output:
`
ā Successfully switched to account: Live2910P-20251028-0155@onkeydepzai.com
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 fetch if needed)---
Authentication Methods
$3
`bash
auggiegw login
`Credentials are stored in
~/.auggiegw/auth.json and automatically used for subsequent commands.$3
Set the
AUGGIEGW_AUTH_TOKEN environment variable:`bash
export AUGGIEGW_AUTH_TOKEN=your_token_here
`When this environment variable is set, the CLI uses it directly without requiring the login command or auth.json file.
Example in CI/CD:
`yaml
GitHub Actions example
env:
AUGGIEGW_AUTH_TOKEN: ${{ secrets.AUGGIEGW_AUTH_TOKEN }}
`---
Configuration
$3
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:
`bash
Preserve session for a single command
auggiegw --preserve-session fetchExplicitly delete session (default behavior)
auggiegw --delete-session fetch
`#### 2. Environment Variable
Set
AUGGIEGW_DELETE_SESSION to control default behavior:`bash
Preserve sessions by default
export AUGGIEGW_DELETE_SESSION=false
auggiegw fetchDelete sessions by default (same as built-in default)
export AUGGIEGW_DELETE_SESSION=true
auggiegw fetch
`#### 3. 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:
1. Command-line flags (
--preserve-session or --delete-session) - Always takes precedence
2. Environment variable (AUGGIEGW_DELETE_SESSION) - Used if no CLI flag is provided
3. Default behavior (delete session) - Used if neither flag nor environment variable is setExamples:
`bash
CLI flag overrides environment variable
export AUGGIEGW_DELETE_SESSION=false
auggiegw --delete-session fetch # Session WILL be deletedEnvironment variable is used when no flag is provided
export AUGGIEGW_DELETE_SESSION=false
auggiegw fetch # Session will NOT be deletedDefault behavior when nothing is set
unset AUGGIEGW_DELETE_SESSION
auggiegw fetch # Session WILL be deleted (default)
`$3
-
AUGGIEGW_AUTH_TOKEN: Authentication token for API access (alternative to login command)
- AUGGIEGW_DELETE_SESSION: Control Auggie session deletion behavior
- Set to false to preserve chat history when switching accounts
- Set to true or leave unset for default behavior (delete session)
- Can be overridden by command-line flags$3
- 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:`markdown
---
description: Prompt Name
---Prompt content goes here...
`The filename corresponds to the command name (e.g.,
my-command.md).---
Usage Examples
$3
`bash
Method 1: Using command-line flag
auggiegw login user1
auggiegw --preserve-session fetch
auggiegw --preserve-session auggieSwitch to another account
auggiegw login user2
auggiegw --preserve-session fetch
auggiegw --preserve-session auggie
`$3
`bash
Default behavior - session is deleted
auggiegw login user1
auggiegw fetch
auggiegw auggieSwitch to another account - previous session is cleared
auggiegw login user2
auggiegw fetch
auggiegw auggie
`$3
`bash
Set environment variable once
export AUGGIEGW_DELETE_SESSION=falseAll subsequent commands preserve session
auggiegw login user1
auggiegw fetch
auggiegw auggieSwitch accounts without losing history
auggiegw login user2
auggiegw fetch
auggiegw auggie
`$3
`bash
Set default to preserve
export AUGGIEGW_DELETE_SESSION=falseThis preserves session (follows env var)
auggiegw fetchThis deletes session (CLI flag overrides env var)
auggiegw --delete-session fetch
`$3
`yaml
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 deploy
`---
Requirements
- Node.js: >= 18.0.0
- Bun: For package management and running scripts (development)
- Auggie CLI: Required for
auggiegw auggie command---
Troubleshooting
$3
`
Error: Not logged in. Please run "auggiegw login" first.
`Solution: Run
auggiegw login to authenticate.$3
Possible causes:
- Invalid credentials
- Network connectivity issues
- API endpoint unavailable
Solution:
1. Verify your credentials with
auggiegw logout then auggiegw login
2. Check your network connection
3. Verify the API URL is correct$3
Solution: Contact your administrator to ensure your account has proxy access configured.
$3
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:
`bash
Login to new account
auggiegw login newuserFetch with preserved session
auggiegw --preserve-session fetchOr use with auggie command
auggiegw --preserve-session auggie
`Solution 2: Use Environment Variable
Set a persistent default behavior:
`bash
Set the environment variable to disable session deletion
export AUGGIEGW_DELETE_SESSION=falseThen run your commands as usual
auggiegw login newuser
auggiegw fetch
`Solution 3: Mixed Approach
Combine both methods for flexibility:
`bash
Set default to preserve
export AUGGIEGW_DELETE_SESSION=falseMost commands will preserve session
auggiegw fetchBut you can override for specific commands
auggiegw --delete-session fetch # This will delete the session
``Note: 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.
---
See LICENSE file for details.
For issues and questions, please open an issue on the GitHub repository.