@plosson/agentio 0.1.31 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/status.ts +30 -4
package/package.json
CHANGED
package/src/commands/status.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { listProfiles, CONFIG_DIR } from '../config/config-manager';
|
|
2
|
+
import { listProfiles, listEnv, CONFIG_DIR } from '../config/config-manager';
|
|
3
3
|
import { getCredentials, setCredentials } from '../auth/token-store';
|
|
4
4
|
import { createGoogleAuth } from '../auth/token-manager';
|
|
5
5
|
import { refreshJiraToken } from '../auth/jira-oauth';
|
|
@@ -115,13 +115,13 @@ export function registerStatusCommand(program: Command): void {
|
|
|
115
115
|
.command('status')
|
|
116
116
|
.description('Show configured profiles and credential status')
|
|
117
117
|
.option('--no-test', 'Skip credential testing')
|
|
118
|
+
.option('--json', 'Output in JSON format')
|
|
118
119
|
.action(async (options) => {
|
|
119
120
|
try {
|
|
120
121
|
const allProfiles = await listProfiles();
|
|
121
122
|
const version = program.version();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
console.log(`Config: ${CONFIG_DIR}\n`);
|
|
123
|
+
const envVars = await listEnv();
|
|
124
|
+
const envKeys = Object.keys(envVars).sort();
|
|
125
125
|
|
|
126
126
|
// Collect all profile statuses
|
|
127
127
|
const statuses: ProfileStatus[] = [];
|
|
@@ -170,6 +170,32 @@ export function registerStatusCommand(program: Command): void {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// JSON output mode
|
|
174
|
+
if (options.json) {
|
|
175
|
+
// Group profiles by service
|
|
176
|
+
const services: Record<string, Array<Omit<ProfileStatus, 'service'>>> = {};
|
|
177
|
+
for (const s of statuses) {
|
|
178
|
+
const { service, ...rest } = s;
|
|
179
|
+
if (!services[service]) {
|
|
180
|
+
services[service] = [];
|
|
181
|
+
}
|
|
182
|
+
services[service].push(rest);
|
|
183
|
+
}
|
|
184
|
+
const output = {
|
|
185
|
+
version,
|
|
186
|
+
configDir: CONFIG_DIR,
|
|
187
|
+
env: envKeys,
|
|
188
|
+
services,
|
|
189
|
+
};
|
|
190
|
+
console.log(JSON.stringify(output, null, 2));
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Human-readable output
|
|
195
|
+
console.log(`agentio v${version}`);
|
|
196
|
+
console.log(`Config: ${CONFIG_DIR}`);
|
|
197
|
+
console.log(`Env: ${envKeys.length > 0 ? envKeys.join(', ') : 'none'}\n`);
|
|
198
|
+
|
|
173
199
|
if (statuses.length === 0) {
|
|
174
200
|
console.log('No profiles configured.');
|
|
175
201
|
console.log('Run: agentio <service> profile add');
|