@plosson/agentio 0.1.31 → 0.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plosson/agentio",
3
- "version": "0.1.31",
3
+ "version": "0.2.1",
4
4
  "description": "CLI for LLM agents to interact with communication and tracking services",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,7 +10,6 @@ import type { Config } from '../types/config';
10
10
  import type { StoredCredentials } from '../types/tokens';
11
11
 
12
12
  const ALGORITHM = 'aes-256-gcm';
13
- const DEFAULT_EXPORT_FILE = 'agentio.config';
14
13
 
15
14
  interface ExportedData {
16
15
  version: number;
@@ -66,10 +65,9 @@ export function registerConfigCommands(program: Command): void {
66
65
 
67
66
  config
68
67
  .command('export')
69
- .description('Export configuration and credentials to an encrypted file')
68
+ .description('Export configuration and credentials (as environment variables by default, or to a file)')
70
69
  .option('--key <key>', 'Encryption key (64 hex characters). If not provided, a random key will be generated')
71
- .option('--output <file>', 'Output file path', DEFAULT_EXPORT_FILE)
72
- .option('--env', 'Output as environment variables instead of writing to file')
70
+ .option('--file <path>', 'Write encrypted config to file instead of outputting AGENTIO_CONFIG')
73
71
  .action(async (options) => {
74
72
  try {
75
73
  // Validate key if provided
@@ -101,19 +99,15 @@ export function registerConfigCommands(program: Command): void {
101
99
  const key = deriveKeyFromPassword(encryptionKey);
102
100
  const encrypted = encrypt(JSON.stringify(exportData), key);
103
101
 
104
- if (options.env) {
102
+ if (options.file) {
103
+ // Write to file, output just the key
104
+ const filePath = options.file.startsWith('/') ? options.file : join(process.cwd(), options.file);
105
+ await writeFile(filePath, encrypted, { mode: 0o600 });
106
+ console.log(`AGENTIO_KEY=${encryptionKey}`);
107
+ } else {
105
108
  // Output as environment variables
106
109
  console.log(`AGENTIO_KEY=${encryptionKey}`);
107
110
  console.log(`AGENTIO_CONFIG=${encrypted}`);
108
- } else {
109
- // Write to file
110
- const outputPath = join(process.cwd(), options.output);
111
- await writeFile(outputPath, encrypted, { mode: 0o600 });
112
-
113
- console.log(`Configuration exported to: ${outputPath}`);
114
- console.log(`Encryption key: ${encryptionKey}`);
115
- console.log('');
116
- console.log('Keep this key safe! You will need it to import the configuration.');
117
111
  }
118
112
  } catch (error) {
119
113
  handleError(error);
@@ -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
- console.log(`agentio v${version}`);
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');