mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 18:18:43 +00:00
fix(auth): include unified config accounts in auth list command
The `ccs auth list` command was only reading from legacy profiles.json, missing accounts stored in unified config (config.yaml). Now merges profiles from both sources, with unified config taking precedence.
This commit is contained in:
@@ -16,6 +16,7 @@ import { spawn, ChildProcess } from 'child_process';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import ProfileRegistry from './profile-registry';
|
import ProfileRegistry from './profile-registry';
|
||||||
|
import { ProfileMetadata } from '../types';
|
||||||
import { InstanceManager } from '../management/instance-manager';
|
import { InstanceManager } from '../management/instance-manager';
|
||||||
import {
|
import {
|
||||||
initUI,
|
initUI,
|
||||||
@@ -285,8 +286,21 @@ class AuthCommands {
|
|||||||
const { verbose, json } = this.parseArgs(args);
|
const { verbose, json } = this.parseArgs(args);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const profiles = this.registry.getAllProfiles();
|
// Get profiles from both legacy (profiles.json) and unified config (config.yaml)
|
||||||
const defaultProfile = this.registry.getDefaultProfile();
|
const legacyProfiles = this.registry.getAllProfiles();
|
||||||
|
const unifiedAccounts = this.registry.getAllAccountsUnified();
|
||||||
|
|
||||||
|
// Merge profiles: unified config takes precedence
|
||||||
|
const profiles: Record<string, ProfileMetadata> = { ...legacyProfiles };
|
||||||
|
for (const [name, account] of Object.entries(unifiedAccounts)) {
|
||||||
|
profiles[name] = {
|
||||||
|
type: 'account',
|
||||||
|
created: account.created,
|
||||||
|
last_used: account.last_used,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultProfile = this.registry.getDefaultUnified() ?? this.registry.getDefaultProfile();
|
||||||
const profileNames = Object.keys(profiles);
|
const profileNames = Object.keys(profiles);
|
||||||
|
|
||||||
// JSON output mode
|
// JSON output mode
|
||||||
|
|||||||
Reference in New Issue
Block a user