Skip to content

Add aio app console where and aio app console open - #929

Open
obarcelonap wants to merge 4 commits into
adobe:masterfrom
obarcelonap:where
Open

Add aio app console where and aio app console open#929
obarcelonap wants to merge 4 commits into
adobe:masterfrom
obarcelonap:where

Conversation

@obarcelonap

Copy link
Copy Markdown
Member

Description

Adds two new commands, aio app console where and aio app console open, that let you inspect and jump to the Adobe Developer Console Org/Project/Workspace the current app is linked to (as set by aio app use).

aio app console where prints the Org/Project/Workspace this app is currently set to use:

$ aio app console where
This app is set to use:
1. Org: Acme Corp
2. Project: my-project
3. Workspace: Stage

It also supports --json and --yml for scripting:

$ aio app console where --json
{
  "org": { "id": "12345", "name": "Acme Corp" },
  "project": { "id": "67890", "name": "my-project" },
  "workspace": { "id": "54321", "name": "Stage" }
}

aio app console open opens that same Workspace directly in the Developer Console web UI, in the default browser - no need to navigate through the Console UI to find the right Org/Project/Workspace.

$ aio app console open
(opens https://developer.adobe.com/console/projects/12345/67890/workspaces/54321/details)

If the app hasn't been linked to a Console configuration yet (no local .aio file), both commands fail with a clear, actionable message instead of doing nothing or showing unrelated data:

$ aio app console where
 ›   Error: This app is not set to use any Org/Project/Workspace yet. Run
 ›   `aio app use` to configure it.

Related Issue

N/A

Motivation and Context

There was no local, per-app equivalent of aio console where/aio console open (which only report the global CLI-wide Org/Project/Workspace selection). Once an app is linked via aio app use, there was no quick way to check which Org/Project/Workspace it's actually configured against, or to jump to it in the Developer Console, without re-reading the .aio file by hand or re-running aio app use interactively (which can prompt to switch workspace/services - not a safe "just show me" operation).

How Has This Been Tested?

  • Added unit tests covering both commands' happy path (text/JSON/YAML output, URL construction for prod/stage and with/without a workspace selected) and the "not configured" error path.
  • Linted the full src/test tree.
  • Linked the plugin into a local install of @adobe/aio-cli (aio plugins link .) and manually exercised both commands end-to-end through the real aio binary, in directories with a fully-configured local .aio, a partially-configured one (Org/Project but no Workspace), and no .aio at all, to confirm the output/errors above match real CLI behavior (not just bin/run, which formats errors differently).

Screenshots (if appropriate):

N/A (CLI output shown above)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Adds `aio app console where` and `aio app console open`, local-app
equivalents of the global `aio console where`/`aio console open`
commands, to inspect and jump to the org/project/workspace an app is
currently linked to via `aio app use`. Extracts the shared config
loading/formatting logic out of `use.js` into `src/lib/console-helper.js`
so both commands and `use.js` share the same implementation.
Previously these commands silently fell back to the global console
config when no local .aio existed for the app, which could show or
open an unrelated org/project/workspace. Now they fail fast with a
clear message pointing to `aio app use` instead.
Previously loadCurrentConfiguration() merged the local .aio file with
the global console config, so a local .aio missing e.g. workspace
would silently inherit a stale/unrelated workspace from the global
config. These commands now read local-only config exclusively, and
hasLocalConfiguration() only requires org+project locally (workspace
remains a legitimate optional/partial state).
…ding

Both commands referred to "this app" being linked/configured with
different phrasing than the success output's "This app is set to
use:" - reword the error to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant