CLI Reference
The GuideMode CLI provides command-line access to GuideMode features, including authentication, session validation, and work item management.
Installation
Section titled “Installation”Install the CLI globally via npm:
npm install -g guidemodeOr use it directly with npx:
npx guidemode --helpAuthentication
Section titled “Authentication”Before using work item commands, you must authenticate with your GuideMode server.
guidemode login [--server <url>]Opens a browser window for OAuth authentication. Once complete, your API key is stored locally.
Options:
--server <url>- Server URL (default:https://app.guidemode.dev)
Example:
# Login to default serverguidemode login
# Login to custom serverguidemode login --server https://your-instance.guidemode.devLogout
Section titled “Logout”guidemode logoutRemoves stored credentials from your local machine.
Who Am I
Section titled “Who Am I”guidemode whoamiShows the current authenticated user and server.
Setup and Session Syncing
Section titled “Setup and Session Syncing”guidemode setup [--force] [--project] [--no-skill] [--default-policy <allow|deny>]Logs you in, installs the Claude Code sync hooks, asks which repositories should sync, installs a skill that lets Claude manage syncing, and runs a health check.
Hooks are installed for your user account (~/.claude/settings.json) so they apply to every
repository. Use --project to scope them to the current repository instead
(.claude/settings.local.json).
Options:
--force- Re-authenticate even if already logged in--project- Install hooks for this project only--no-skill- Skip installing the Claude Code skill--default-policy <allow|deny>- Choose the sync policy without being prompted
Choosing the default policy
Section titled “Choosing the default policy”Setup asks which repositories should sync and stores the answer. Because that choice decides what
leaves your machine, it is never assumed: running setup without a terminal and without
--default-policy stops with an explanation rather than picking one for you.
allow- every repository syncs unless you disable itdeny- nothing syncs until you enable it, repository by repository
Controlling which repositories sync
Section titled “Controlling which repositories sync”Because hooks are global, syncing is controlled per repository in configuration rather than by where the hooks live.
guidemode config # show settings and whether this repo syncsguidemode disable [--note <text>] # stop syncing this repositoryguidemode enable # sync this repository againguidemode disable --global # stop syncing everywhereguidemode enable --global # resumeguidemode config --default-policy deny # switch to opt-in mode laterguidemode config --refresh-cache # forget cached repository lookupsRepositories are identified by their normalised git remote (for example github.com/acme/app), so
all clones and worktrees of a repository share one setting. Directories with no remote are
identified by path.
Status
Section titled “Status”guidemode status [--verbose] [--json]Checks dependencies, credentials, server reachability, whether the hooks are actually present in your settings file, whether the current directory would sync, and recent log errors.
guidemode sync [--foreground]Invoked by the Claude Code hooks. It performs only cheap checks and hands the upload to a detached
background process, so it returns immediately rather than making you wait mid-session. Pass
--foreground to upload inline when debugging.
guidemode logs [--lines <n>] [--errors] [--follow]Background uploads report their results here.
Uninstall
Section titled “Uninstall”guidemode uninstall [--purge]Removes GuideMode’s hooks (leaving any other tools’ hooks intact) and the skill. --purge also
clears local sync settings and cached state. Credentials are untouched; use guidemode logout for
those.
Environment Variables
Section titled “Environment Variables”For CI/CD environments, you can use environment variables instead of interactive login:
export GUIDEMODE_API_KEY=gai_your_api_key_hereexport GUIDEMODE_SERVICE_URL=https://app.guidemode.devWork Item Commands
Section titled “Work Item Commands”Create or update an issue in GuideMode using GuideMode’s internal data model.
guidemode issue <title> --type <type> --state <state> --project <key> [options]Required Arguments:
<title>- Issue title
Required Options:
--type <type>- Issue type:feature,bug,chore,discovery,incident,other--state <state>- Issue state:open,closed,in_progress--project <key>- Project key (e.g.,"owner/repo"or custom identifier)
Optional:
--external-id <id>- Unique external ID (auto-generated if omitted)--body <text>- Issue description--url <url>- Link to source issue--labels <labels>- Comma-separated labels--assignee <username>- Assignee username--closed-at <timestamp>- ISO8601 timestamp when closed--json- Output JSON response
Examples:
# Create a bug issueguidemode issue "Fix login button" \ --type bug \ --state open \ --project "myorg/myrepo"
# Create a feature with all optionsguidemode issue "Add dark mode" \ --type feature \ --state in_progress \ --project "myorg/myrepo" \ --external-id "JIRA-123" \ --body "Implement dark mode toggle in settings" \ --labels "enhancement,ui" \ --assignee "developer1"
# Close an existing issueguidemode issue "Fix login button" \ --type bug \ --state closed \ --project "myorg/myrepo" \ --external-id "JIRA-123" \ --closed-at "2024-01-15T10:00:00Z"
# Output JSON for scriptingguidemode issue "New feature" \ --type feature \ --state open \ --project "myorg/myrepo" \ --jsonDeploy
Section titled “Deploy”Create or update a deployment in GuideMode.
guidemode deploy <ref> <sha> --env <environment> --status <status> --project <key> [options]Required Arguments:
<ref>- Branch, tag, or ref being deployed (e.g.,main,v1.2.3)<sha>- Commit SHA (7-40 characters, short or full SHA)
Required Options:
--env <environment>- Environment:production,staging,development,qa,preview,other--status <status>- Deployment status:pending,queued,in_progress,success,failure,error--project <key>- Project key (e.g.,"owner/repo")
Optional:
--external-id <id>- Unique external ID (auto-generated if omitted)--description <text>- Deployment description--url <url>- Deployment URL--rollback- Flag this as a rollback deployment--rollback-from <sha>- SHA being rolled back from (7-40 characters)--json- Output JSON response
Examples:
# Record a successful production deploymentguidemode deploy "main" "abc123def456789012345678901234567890abcd" \ --env production \ --status success \ --project "myorg/myrepo"
# Record a deployment in progressguidemode deploy "feature/new-ui" "abc123def456789012345678901234567890abcd" \ --env staging \ --status in_progress \ --project "myorg/myrepo" \ --description "Testing new UI components"
# Record a rollbackguidemode deploy "main" "abc123def456789012345678901234567890abcd" \ --env production \ --status success \ --project "myorg/myrepo" \ --rollback \ --rollback-from "def456789012345678901234567890abcdef12"
# Output JSON for scriptingguidemode deploy "main" "abc123def456789012345678901234567890abcd" \ --env production \ --status success \ --project "myorg/myrepo" \ --jsonCI/CD Integration
Section titled “CI/CD Integration”GitHub Actions
Section titled “GitHub Actions”name: Track Deployment
on: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Deploy application run: ./deploy.sh
- name: Record deployment env: GUIDEMODE_API_KEY: ${{ secrets.GUIDEMODE_API_KEY }} run: | npx @guidemode/cli deploy "${{ github.ref_name }}" "${{ github.sha }}" \ --env production \ --status success \ --project "${{ github.repository }}"GitLab CI
Section titled “GitLab CI”deploy: stage: deploy script: - ./deploy.sh - | npx @guidemode/cli deploy "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" \ --env production \ --status success \ --project "$CI_PROJECT_PATH" variables: GUIDEMODE_API_KEY: $GUIDEMODE_API_KEYShell Script
Section titled “Shell Script”#!/bin/bash# deploy.sh - Record deployment to GuideMode
set -e
# Get current git infoREF=$(git rev-parse --abbrev-ref HEAD)SHA=$(git rev-parse HEAD)PROJECT=$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')
# Deploy your applicationecho "Deploying $REF ($SHA)..."./actual-deploy-script.sh
# Record to GuideModeguidemode deploy "$REF" "$SHA" \ --env production \ --status success \ --project "$PROJECT" \ --description "Automated deployment from CI"Validation Command
Section titled “Validation Command”Validate canonical JSONL session files.
guidemode validate <path> [options]Arguments:
<path>- Path to JSONL file or directory
Options:
--strict- Treat warnings as errors--json- Output JSON format--verbose- Show detailed error information--watch- Watch for file changes and re-validate--provider <name>- Filter by provider name
Exit Codes
Section titled “Exit Codes”0- Success1- Error (authentication, validation, or API error)
Configuration
Section titled “Configuration”Configuration is stored in ~/.guidemode/config.json:
{ "apiKey": "gai_...", "serverUrl": "https://app.guidemode.dev", "username": "your-username", "tenantId": "...", "tenantName": "Your Organization"}The file is created automatically during login. Credentials are stored with restricted permissions (0600).
