Complete implementation planning for CLI app with MFA

- Created implementation plan with technical context
- Developed data models for User Session, Sync Job, and Authentication Token
- Defined API contracts for authentication, sync triggering, and status checking
- Created quickstart guide for CLI usage
- Updated agent context with new technology stack
- Verified constitution compliance for all design decisions
This commit is contained in:
2025-12-18 13:50:51 -08:00
parent ec20c21920
commit 28ab4f3416
7 changed files with 784 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
openapi: 3.0.0
info:
title: GarminSync CLI Authentication API
version: 1.0.0
description: API for CLI-based authentication with MFA support
paths:
/api/auth/cli/login:
post:
summary: Authenticate user via CLI with optional MFA
description: Authenticates a user with username/password and optional MFA code
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- username
- password
properties:
username:
type: string
description: User's email or username
password:
type: string
description: User's password
mfa_code:
type: string
description: MFA code if required
remember_me:
type: boolean
description: Whether to store tokens for future use
responses:
'200':
description: Authentication successful
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
session_id:
type: string
description: Unique session identifier
access_token:
type: string
description: Access token for API calls
token_type:
type: string
description: Type of token (e.g., Bearer)
expires_in:
type: integer
description: Time until token expiration in seconds
mfa_required:
type: boolean
description: Whether MFA is required for this account
user:
type: object
properties:
id:
type: string
description: User identifier
email:
type: string
description: User's email
username:
type: string
description: User's username
'400':
description: Invalid credentials or missing required fields
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
mfa_required:
type: boolean
description: Whether MFA is required for this account
'401':
description: Authentication failed
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
'429':
description: Too many failed attempts
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message

View File

@@ -0,0 +1,185 @@
openapi: 3.0.0
info:
title: GarminSync CLI Sync Status API
version: 1.0.0
description: API for checking sync job status via CLI
paths:
/api/sync/cli/status:
get:
summary: Check status of sync operations
description: Retrieves the status of current and recent sync jobs
security:
- bearerAuth: []
parameters:
- name: job_id
in: query
required: false
description: Specific job ID to check (returns all recent if not provided)
schema:
type: string
responses:
'200':
description: Sync status information retrieved successfully
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
jobs:
type: array
items:
type: object
properties:
job_id:
type: string
description: Unique identifier for the sync job
status:
type: string
description: Current status of the sync job
enum: [pending, running, completed, failed, cancelled]
progress:
type: number
format: float
minimum: 0
maximum: 100
description: Percentage of completion (0-100)
sync_type:
type: string
enum: [activities, health, workouts]
description: Type of data being synced
created_at:
type: string
format: date-time
description: When the job was created
started_at:
type: string
format: date-time
description: When the job started executing
completed_at:
type: string
format: date-time
description: When the job completed (if completed)
total_items:
type: integer
description: Total number of items to sync
processed_items:
type: integer
description: Number of items processed so far
error_message:
type: string
description: Error details if job failed
'401':
description: Authentication required or invalid token
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
/api/sync/cli/status/{job_id}:
get:
summary: Check status of a specific sync job
description: Retrieves the status of a specific sync job by ID
security:
- bearerAuth: []
parameters:
- name: job_id
in: path
required: true
description: Unique identifier of the sync job
schema:
type: string
responses:
'200':
description: Specific sync job status retrieved successfully
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
job:
type: object
properties:
job_id:
type: string
description: Unique identifier for the sync job
status:
type: string
description: Current status of the sync job
enum: [pending, running, completed, failed, cancelled]
progress:
type: number
format: float
minimum: 0
maximum: 100
description: Percentage of completion (0-100)
sync_type:
type: string
enum: [activities, health, workouts]
description: Type of data being synced
created_at:
type: string
format: date-time
description: When the job was created
started_at:
type: string
format: date-time
description: When the job started executing
completed_at:
type: string
format: date-time
description: When the job completed (if completed)
total_items:
type: integer
description: Total number of items to sync
processed_items:
type: integer
description: Number of items processed so far
error_message:
type: string
description: Error details if job failed
'401':
description: Authentication required or invalid token
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
'404':
description: Sync job not found
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT

View File

@@ -0,0 +1,107 @@
openapi: 3.0.0
info:
title: GarminSync CLI Sync Trigger API
version: 1.0.0
description: API for triggering sync operations via CLI
paths:
/api/sync/cli/trigger:
post:
summary: Trigger a sync operation via CLI
description: Initiates a data sync operation for the authenticated user
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
sync_type:
type: string
enum: [activities, health, workouts]
description: Type of data to sync
date_range:
type: object
properties:
start_date:
type: string
format: date
description: Start date for sync (YYYY-MM-DD)
end_date:
type: string
format: date
description: End date for sync (YYYY-MM-DD)
force_full_sync:
type: boolean
description: Whether to perform a full sync instead of incremental
responses:
'200':
description: Sync operation successfully initiated
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
job_id:
type: string
description: Unique identifier for the sync job
status:
type: string
description: Current status of the sync job
enum: [pending, running]
message:
type: string
description: Status message
'400':
description: Invalid request parameters
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
'401':
description: Authentication required or invalid token
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
'409':
description: Sync already in progress for this user
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
active_job_id:
type: string
description: ID of the currently active job
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT