Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"ora": "^9.3.0",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"slugify": "^1.6.9",
"smol-toml": "^1.6.1",
"ws": "^8.20.0",
"zod": "^3.25.76"
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

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

8 changes: 5 additions & 3 deletions src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export abstract class AblyBaseCommand extends InteractiveBaseCommand {
constructor(argv: string[], config: CommandConfig) {
super(argv, config);
this.configManager = createConfigManager();
this.interactiveHelper = new InteractiveHelper(this.configManager);
this.interactiveHelper = new InteractiveHelper(this.configManager, {
log: this.log.bind(this),
});
// Check if we're running in web CLI mode
this.isWebCliMode = isWebCliMode();
}
Expand Down Expand Up @@ -610,9 +612,9 @@ export abstract class AblyBaseCommand extends InteractiveBaseCommand {
if (!appName) {
try {
// Get access token for control API
const currentAccount = this.configManager.getCurrentAccount();
const accessToken =
process.env.ABLY_ACCESS_TOKEN || currentAccount?.accessToken;
process.env.ABLY_ACCESS_TOKEN ||
this.configManager.getAccessToken();

if (accessToken) {
const controlApi = new ControlApi({
Expand Down
12 changes: 4 additions & 8 deletions src/commands/accounts/current.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import chalk from "chalk";

import { ControlBaseCommand } from "../../control-base-command.js";
import { errorMessage } from "../../utils/errors.js";
import { ControlApi } from "../../services/control-api.js";
import { formatLabel } from "../../utils/output.js";

export default class AccountsCurrent extends ControlBaseCommand {
Expand Down Expand Up @@ -38,14 +37,11 @@ export default class AccountsCurrent extends ControlBaseCommand {
);
}

// Verify the account by making an API call to get up-to-date information
// Verify the account by making an API call to get up-to-date information.
// Route through createControlApi so OAuth accounts get the same
// TokenRefreshMiddleware used by every other control command.
try {
const { accessToken } = currentAccount;

const controlApi = new ControlApi({
accessToken,
controlHost: flags["control-host"],
});
const controlApi = this.createControlApi(flags);

const { account, user } = await controlApi.getMe();

Expand Down
Loading
Loading