Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,186 changes: 4,165 additions & 1,021 deletions ATTRIBUTIONS.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 46 additions & 16 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,78 @@ npm install -g @aignostics/cli

## Usage

All commands accept a global `--environment` option (`production` [default], `staging`, `develop`).

All commands also accept a global `--format` option (`text` [default], `json`). `text` prints a
human-friendly table or summary showing the most relevant fields; `json` prints the full raw
response, useful for scripting.

### Authentication

```bash
# Login to the platform
aignostics-platform login --endpoint https://api.aignostics.com --client-id your-client-id
# Login to the platform (opens a browser)
aignostics-platform auth login

# Login using an existing refresh token
aignostics-platform auth login --refreshToken <token>

# Check authentication status
aignostics-platform auth status

# Logout and remove the stored token
aignostics-platform auth logout

# Test API connection
aignostics-platform test --endpoint https://api.aignostics.com
aignostics-platform test-api
```

### Application Management
### Application Discovery

```bash
# List applications
aignostics-platform applications list --endpoint https://api.aignostics.com
aignostics-platform applications list

# List application versions
aignostics-platform applications versions --endpoint https://api.aignostics.com --application-id app-id
# Get details for a specific application
aignostics-platform applications get <applicationId>

# List application runs
aignostics-platform applications runs list --endpoint https://api.aignostics.com
# List versions of an application
aignostics-platform applications versions list <applicationId>

# Get details of a specific application version
aignostics-platform applications versions get <applicationId> <versionNumber>
```

### Run Management

```bash
# Create a new application run, with items provided inline...
aignostics-platform runs create <applicationId> <versionNumber> --items '[{"wsi_id": "wsi-123"}]'

# ...from a file...
aignostics-platform runs create <applicationId> <versionNumber> --items-file ./items.json

# ...or piped via stdin
cat items.json | aignostics-platform runs create <applicationId> <versionNumber>

# List application runs, optionally filtered/sorted
aignostics-platform runs list --applicationId <applicationId> --sort '-submitted_at'

# Get run details
aignostics-platform runs get --endpoint https://api.aignostics.com --run-id run-id
aignostics-platform runs get <applicationRunId>

# Cancel a run
aignostics-platform runs cancel --endpoint https://api.aignostics.com --run-id run-id
aignostics-platform runs cancel <applicationRunId>

# List run results
aignostics-platform runs results --endpoint https://api.aignostics.com --run-id run-id
aignostics-platform runs results list <applicationRunId>
```

## Commands

- `info` - Display CLI version information
- `login` - Authenticate with the platform
- `test` - Test API connection
- `applications` - Manage applications
- `runs` - Manage application runs
- `test-api` - Test API connection
- `auth` - `login`, `logout`, `status`
- `applications` - `list`, `get`, `versions list`, `versions get`
- `runs` - `create`, `list`, `get`, `cancel`, `results list`

For detailed usage information, use `aignostics-platform --help` or `aignostics-platform <command> --help`.
12 changes: 6 additions & 6 deletions packages/cli/e2e/features/TC-application-discovery.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Application Discovery
@id:TC-APP-LIST
@tests:SWR-APP-DISCOVERY-LIST
Scenario: Retrieve all available applications
When I run the CLI command "list-applications"
When I run the CLI command "applications list"
Then the exit code should be 0
And I should see "Applications:" in the output
And the output should contain a valid JSON array of applications
Expand All @@ -19,7 +19,7 @@ Feature: Application Discovery
@id:TC-APP-DETAILS
@tests:SWR-APP-DISCOVERY-VERSION-DETAILS
Scenario: View application details including regulatory information
When I run the CLI command "list-applications"
When I run the CLI command "applications list"
Then the exit code should be 0
And the output should contain application "test-app"
And application "test-app" should have property "application_id" with value "test-app"
Expand All @@ -31,7 +31,7 @@ Feature: Application Discovery
@tests:SWR-APP-DISCOVERY-VERSION-LIST
@tests:SWR-APP-DISCOVERY-DETAILS
Scenario: Retrieve all versions for a specific application
When I run the CLI command "list-application-versions test-app"
When I run the CLI command "applications versions list test-app"
Then the exit code should be 0
And I should see "Application versions for test-app:" in the output
And the output should contain a valid JSON array of versions
Expand All @@ -41,15 +41,15 @@ Feature: Application Discovery
@id:TC-VERSION-LIST-NOT-FOUND
@tests:SWR-APP-DISCOVERY-VERSION-LIST
Scenario: Handle error when listing versions for non-existent application
When I run the CLI command "list-application-versions non-existent-app"
When I run the CLI command "applications versions list non-existent-app"
Then I should see "API_ERROR" in stderr
And I should see "application not found" in stderr
And the exit code should not be 0

@id:TC-VERSION-DETAILS
@tests:SWR-APP-DISCOVERY-VERSION-DETAILS
Scenario: View specific application version details
When I run the CLI command "get-application-version-details test-app 1.0.0"
When I run the CLI command "applications versions get test-app 1.0.0"
Then the exit code should be 0
And I should see "Application version details for test-app v1.0.0:" in the output
And the output should contain a JSON object with "version_number" equal to "1.0.0"
Expand All @@ -60,7 +60,7 @@ Feature: Application Discovery
@tests:SWR-ERROR-COMM-DIAGNOSTIC-CONTEXT
@tests:SWR-ERROR-COMM-CLASSIFICATION
Scenario: Handle error when requesting non-existent version details
When I run the CLI command "get-application-version-details test-app 2.0.0"
When I run the CLI command "applications versions get test-app 2.0.0"
Then I should see "API_ERROR" in stderr
And I should see "Application version not found" in stderr
And the exit code should not be 0
8 changes: 4 additions & 4 deletions packages/cli/e2e/features/TC-application-execution.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Application Execution
@tests:SWR-APP-EXEC-INPUT-ARTIFACT
Scenario: Create application run with valid input items
Given I have 2 valid input artifacts for "test-app" version "1.0.0"
When I run the CLI command "create-run test-app 1.0.0 --items <items_json>"
When I run the CLI command "runs create test-app 1.0.0 --items <items_json>"
Then the exit code should be 0
And I should see "Application run created successfully:" in the output
And the output should contain a JSON object with property "run_id"
Expand All @@ -22,22 +22,22 @@ Feature: Application Execution
@tests:SWR-ERROR-COMM-CLI-OUTPUT
Scenario: Handle error when creating run with non-existent version
Given I have 2 valid input artifacts for "test-app" version "1.0.0"
When I run the CLI command "create-run test-app 2.0.0 --items <items_json>"
When I run the CLI command "runs create test-app 2.0.0 --items <items_json>"
Then I should see "API_ERROR" in stderr
And I should see "application version not found" in stderr
And the exit code should not be 0

@id:TC-RUN-CREATE-MISSING-ARGS
@tests:SWR-ERROR-COMM-MESSAGES
Scenario: Handle error when creating run with missing arguments
When I run the CLI command "create-run"
When I run the CLI command "runs create"
Then I should see "Not enough non-option arguments: got 0, need at least 2" in stderr
And the exit code should not be 0

@id:TC-RUN-CREATE-INVALID-JSON
@tests:SWR-APP-EXEC-REQUEST-VALIDATION
@tests:SWR-ERROR-COMM-MESSAGES
Scenario: Validate items JSON before submission
When I run the CLI command "create-run test-app 1.0.0 --items invalid-json"
When I run the CLI command "runs create test-app 1.0.0 --items invalid-json"
Then I should see "Invalid items JSON:" in stderr
And the exit code should not be 0
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Application Results Access
Scenario: Retrieve items and output artifacts for a run
Given I have a list of runs for "test-app" version "1.0.0"
And I select the latest run ID from the list
When I run the CLI command "list-run-results <run_id>"
When I run the CLI command "runs results list <run_id>"
Then the exit code should be 0
And I should see "Run results for <run_id>:" in the output
And the output should contain a valid JSON array of run results
Expand All @@ -23,7 +23,7 @@ Feature: Application Results Access
Scenario: View execution state and status details for items
Given I have a list of runs for "test-app" version "1.0.0"
And I select the latest run ID from the list
When I run the CLI command "list-run-results <run_id>"
When I run the CLI command "runs results list <run_id>"
Then the exit code should be 0
And each result should have property "state"
And each result should have property "termination_reason"
Expand All @@ -37,7 +37,7 @@ Feature: Application Results Access
@tests:SWR-ERROR-COMM-MESSAGES
@tests:SWR-ERROR-COMM-CLI-OUTPUT
Scenario: Handle error when requesting results with invalid run ID
When I run the CLI command "list-run-results non-existent-run-id"
When I run the CLI command "runs results list non-existent-run-id"
Then I should see "API_ERROR" in stderr
And I should see "Validation error" in stderr
And the exit code should not be 0
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Application Run Management
@id:TC-RUN-LIST
@tests:SWR-APP-RUN-MGMT-LIST
Scenario: List application runs with filtering
When I run the CLI command "list-application-runs --applicationId test-app --applicationVersion 1.0.0"
When I run the CLI command "runs list --applicationId test-app --applicationVersion 1.0.0"
Then the exit code should be 0
And I should see "Application runs:" in the output
And the output should contain a valid JSON array of runs
Expand All @@ -21,7 +21,7 @@ Feature: Application Run Management
Scenario: Retrieve detailed information for a specific run
Given I have a list of runs for "test-app" version "1.0.0"
And I select the latest run ID from the list
When I run the CLI command "get-run <run_id>"
When I run the CLI command "runs get <run_id>"
Then the exit code should be 0
And I should see "Run details for <run_id>:" in the output
And the output should contain a JSON object with "run_id" equal to "<run_id>"
Expand All @@ -32,6 +32,6 @@ Feature: Application Run Management
Scenario: Cancel a pending application run
Given I have a list of runs for "test-app" version "1.0.0"
And there is a run with state "PENDING"
When I run the CLI command "cancel-run <pending_run_id>"
When I run the CLI command "runs cancel <pending_run_id>"
Then the exit code should be 0
And I should see "Successfully cancelled application run: <pending_run_id>" in the output
11 changes: 8 additions & 3 deletions packages/cli/e2e/specs/1-Authentication.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Authentication', () => {
try {
let authUrl = '';

const cliPromise = executeCLI(['login']);
const cliPromise = executeCLI(['auth', 'login']);

const dataHandler = (data: Buffer) => {
const output = String(data);
Expand Down Expand Up @@ -160,7 +160,12 @@ describe('Authentication', () => {
await annotate('SWR-AUTH-SECURE-STORAGE', 'tests');
await annotate('TC-AUTH-TOKEN', 'id');

const { stdout: loginStdout } = await executeCLI(['login', '--refreshToken', refreshToken]);
const { stdout: loginStdout } = await executeCLI([
'auth',
'login',
'--refreshToken',
refreshToken,
]);
expect(loginStdout).toContain('🎉 Login with refresh token successful! Token saved securely.');

const { stdout: testApiStdout } = await executeCLI(['test-api']);
Expand Down Expand Up @@ -208,7 +213,7 @@ describe('Authentication', () => {

const data = await tokenStorage.load(environment);

await executeCLI(['logout'], { reject: false });
await executeCLI(['auth', 'logout'], { reject: false });

const { stderr: testApiStderr } = await executeCLI(['test-api'], { reject: false });

Expand Down
14 changes: 8 additions & 6 deletions packages/cli/e2e/specs/2-Application Discovery.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('SWR Application List Retrieval', () => {
await annotate('SWR-APP-DISCOVERY-LIST', 'tests');
await annotate('TC-APP-LIST', 'id');

const { stdout, exitCode } = await executeCLI(['list-applications']);
const { stdout, exitCode } = await executeCLI(['applications', 'list']);

expect(exitCode).toBe(0);

Expand All @@ -44,7 +44,7 @@ describe('SWR Application Details', () => {
await annotate('SWR-APP-DISCOVERY-VERSION-DETAILS', 'tests');
await annotate('TC-APP-DETAILS', 'id');

const { stdout, exitCode } = await executeCLI(['list-applications']);
const { stdout, exitCode } = await executeCLI(['applications', 'list']);

expect(exitCode).toBe(0);

Expand Down Expand Up @@ -76,7 +76,7 @@ describe('SWR Version List Retrieval', () => {
await annotate('SWR-APP-DISCOVERY-DETAILS', 'tests');
await annotate('TC-VERSION-LIST', 'id');

const { stdout, exitCode } = await executeCLI(['list-application-versions', 'test-app']);
const { stdout, exitCode } = await executeCLI(['applications', 'versions', 'list', 'test-app']);

expect(exitCode).toBe(0);

Expand All @@ -103,7 +103,7 @@ describe('SWR Version List Retrieval', () => {
it('should return an error when the app does not exist', async ({ annotate }) => {
await annotate('TC-VERSION-LIST-NOT-FOUND', 'id');

const { stderr } = await executeCLI(['list-application-versions', 'non-existent-app'], {
const { stderr } = await executeCLI(['applications', 'versions', 'list', 'non-existent-app'], {
reject: false,
});

Expand All @@ -118,7 +118,9 @@ describe('SWR Specific Version Details', () => {
await annotate('TC-VERSION-DETAILS', 'id');

const { stdout, exitCode } = await executeCLI([
'get-application-version-details',
'applications',
'versions',
'get',
'test-app',
'1.0.0',
]);
Expand All @@ -144,7 +146,7 @@ describe('SWR Specific Version Details', () => {
await annotate('SWR-ERROR-COMM-CLASSIFICATION', 'tests');
await annotate('TC-VERSION-DETAILS-NOT-FOUND', 'id');

const { stderr } = await executeCLI(['get-application-version-details', 'test-app', '2.0.0'], {
const { stderr } = await executeCLI(['applications', 'versions', 'get', 'test-app', '2.0.0'], {
reject: false,
});
expect(stderr).toMatch(/API_ERROR/);
Expand Down
Loading