Taylor Eernisse
|
8fb890c528
|
feat(cli): Implement complete command-line interface
Provides a user-friendly CLI for all GitLab Inbox operations.
src/cli/mod.rs - Clap command definitions:
- Global --config flag for alternate config path
- Subcommands: init, auth-test, doctor, version, backup, reset,
migrate, sync-status, ingest, list, count, show
- Ingest supports --type (issues/merge_requests), --project filter,
--force lock override, --full resync
- List supports rich filtering: --state, --author, --assignee,
--label, --milestone, --since, --due-before, --has-due-date
- List supports --sort (updated/created/iid), --order (asc/desc)
- List supports --open to launch browser, --json for scripting
src/cli/commands/ - Command implementations:
init.rs: Interactive configuration wizard
- Prompts for GitLab URL, token env var, projects to track
- Creates config file and initializes database
- Supports --force overwrite and --non-interactive mode
auth_test.rs: Verify GitLab authentication
- Calls /api/v4/user to validate token
- Displays username and GitLab instance URL
doctor.rs: Environment health check
- Validates config file exists and parses correctly
- Checks database connectivity and migration state
- Verifies GitLab authentication
- Reports token environment variable status
- Supports --json output for CI integration
ingest.rs: Data synchronization from GitLab
- Acquires sync lock with stale detection
- Shows progress bars for issues and discussions
- Reports sync statistics on completion
- Supports --full flag to reset cursors and refetch all data
list.rs: Query local database
- Formatted table output with comfy-table
- Filters build dynamic SQL with parameterized queries
- Username filters normalize @ prefix automatically
- --open flag uses 'open' crate for cross-platform browser launch
- --json outputs array of issue objects
show.rs: Detailed entity view
- Displays issue metadata in structured format
- Shows full description with markdown
- Lists labels, assignees, milestone
- Shows discussion threads with notes
count.rs: Entity statistics
- Counts issues, discussions, or notes
- Supports --type filter for discussions/notes
sync_status.rs: Display sync watermarks
- Shows last sync time per project
- Displays cursor positions for debugging
src/main.rs - Application entry point:
- Initializes tracing subscriber with env-filter
- Parses CLI arguments via clap
- Dispatches to appropriate command handler
- Consistent error formatting for all failure modes
src/lib.rs - Library entry point:
- Exports cli, core, gitlab, ingestion modules
- Re-exports Config, GiError, Result for convenience
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-26 11:28:52 -05:00 |
|