milesoft app
Retrieve, list, and switch between available active apps.
milesoft app list
Retrieve a collection of apps currently registered/accessible in the user session.
Operational Overview
- Caching Mechanism: Optimizes performance by first checking for a pre-populated list in the local session configuration file
~/.config/milesoft/session.json. If cached entries are found, they are displayed instantly. If the local cache is empty or missing, the command falls back to query the platform gateway (/api/v2/auth/apps), caches the returned app set locally, and then outputs them. - Output Mode Selection:
- Terminal (TTY) Mode: Renders an elegant 61-character ASCII table. App IDs are displayed on the left, and names (truncated to a maximum of 37 characters) on the right.
- Non-Interactive / JSON Mode: When standard output is piped/redirected, or when the
--jsonflag is provided, the command automatically falls back to printing a robust, indentation-formatted JSON representation of the cached apps list.
- Usage:
milesoft app list [flags]
Examples
Terminal TTY Output (Default)
$ milesoft app list
=============================================================
APP ID NAME
=============================================================
app-123-prod Main Developer Suite
app-456-test Customer Portal
app-789-ext Partner Integration Portal with Extre...
=============================================================
Automated JSON Output (via Pipe, Redirect, or --json)
$ milesoft app list --json
JSON Schema Result:
[
{
"id": "app-123-prod",
"title": "Main Developer Suite"
},
{
"id": "app-456-test",
"title": "Customer Portal"
},
{
"id": "app-789-ext",
"title": "Partner Integration Portal with Extreme Brand Scaling"
}
]
milesoft app switch
Switch the active session token context to a specified or selected App ID.
Operational Overview
- Swapping Mechanics: Triggers a gateway-level session swap request (
/api/v2/auth/swap). This re-authenticates the current user session under the context of the target App ID, retrieves a new pair of access and refresh tokens, updates the native OS Keychain secure keyring, and refreshes the local credentials configuration. - Argument-Driven Mode (Non-Interactive): When you pass an
[app-id]argument (e.g.,milesoft app switch app-123-prod), the CLI validates it against the authorized app cache. If valid, it immediately switches. If invalid or unauthorized, it fails with:Error: app ID <app-id> is not valid/authorized for current user. - Interactive Menu Mode (Prompting): If you execute the command with no arguments, the CLI lists all available applications in a numbered menu, reads your choice from standard input, validates that the choice is in range, and performs the switch dynamically.
- Usage:
milesoft app switch [app-id] [flags]
Examples
Switch to a Specified App ID
$ milesoft app switch app-456-test
Switching active context to App ID: app-456-test...
Success! Context successfully switched to App ID: app-456-test.
Attempting Switch to an Invalid/Unauthorized App ID
$ milesoft app switch app-invalid-id
Error: app ID app-invalid-id is not valid/authorized for current user
Interactive Selection Menu (No Arguments Provided)
$ milesoft app switch
Available applications:
[1] Main Developer Suite (ID: app-123-prod)
[2] Customer Portal (ID: app-456-test)
[3] Partner Integration Portal (ID: app-789-ext)
Select an app to switch to [1-3]: 2
Switching active context to App ID: app-456-test...
Success! Context successfully switched to App ID: app-456-test.