@plosson/agentio 0.4.4 → 0.5.2
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/config.ts +13 -7
- package/src/commands/discourse.ts +5 -1
- package/src/commands/gateway.ts +384 -87
- package/src/commands/gcal.ts +14 -5
- package/src/commands/gchat.ts +16 -10
- package/src/commands/gdocs.ts +8 -2
- package/src/commands/gdrive.ts +9 -3
- package/src/commands/github.ts +8 -1
- package/src/commands/gmail.ts +14 -5
- package/src/commands/gsheets.ts +16 -6
- package/src/commands/gtasks.ts +24 -10
- package/src/commands/jira.ts +10 -3
- package/src/commands/slack.ts +10 -4
- package/src/commands/sql.ts +18 -2
- package/src/commands/status.ts +13 -7
- package/src/commands/telegram.ts +14 -2
- package/src/commands/whatsapp.ts +24 -4
- package/src/config/config-manager.ts +104 -14
- package/src/gateway/api.ts +9 -12
- package/src/gateway/client.ts +18 -15
- package/src/gateway/daemon.ts +35 -203
- package/src/gateway/types.ts +4 -4
- package/src/services/gdrive/client.ts +19 -9
- package/src/types/config.ts +30 -21
- package/src/utils/output.ts +8 -15
- package/src/utils/profile-commands.ts +36 -5
- package/src/utils/read-only.ts +22 -0
package/package.json
CHANGED
package/src/commands/config.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { getAllCredentials, setAllCredentials } from '../auth/token-store';
|
|
|
8
8
|
import { CliError, handleError } from '../utils/errors';
|
|
9
9
|
import { confirm } from '../utils/stdin';
|
|
10
10
|
import { isInteractive, interactiveCheckbox, interactiveSelect } from '../utils/interactive';
|
|
11
|
-
import type { Config, ServiceName } from '../types/config';
|
|
11
|
+
import type { Config, ServiceName, ProfileValue } from '../types/config';
|
|
12
12
|
import type { StoredCredentials } from '../types/tokens';
|
|
13
13
|
|
|
14
14
|
interface ProfileSelection {
|
|
@@ -126,8 +126,9 @@ export function registerConfigCommands(program: Command): void {
|
|
|
126
126
|
const allProfiles: ProfileSelection[] = [];
|
|
127
127
|
for (const [service, profiles] of Object.entries(configData.profiles)) {
|
|
128
128
|
if (profiles) {
|
|
129
|
-
for (const
|
|
130
|
-
|
|
129
|
+
for (const entry of profiles) {
|
|
130
|
+
const profileName = typeof entry === 'string' ? entry : entry.name;
|
|
131
|
+
allProfiles.push({ service: service as ServiceName, profile: profileName });
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
}
|
|
@@ -309,11 +310,16 @@ export function registerConfigCommands(program: Command): void {
|
|
|
309
310
|
for (const [service, profiles] of Object.entries(exportData.config.profiles)) {
|
|
310
311
|
if (profiles) {
|
|
311
312
|
if (!currentConfig.profiles[service as keyof typeof currentConfig.profiles]) {
|
|
312
|
-
(currentConfig.profiles as Record<string,
|
|
313
|
+
(currentConfig.profiles as Record<string, ProfileValue[]>)[service] = [];
|
|
313
314
|
}
|
|
314
|
-
for (const
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
for (const entry of profiles) {
|
|
316
|
+
const profileName = typeof entry === 'string' ? entry : entry.name;
|
|
317
|
+
const currentProfiles = (currentConfig.profiles as Record<string, ProfileValue[]>)[service];
|
|
318
|
+
const exists = currentProfiles.some((p) =>
|
|
319
|
+
(typeof p === 'string' ? p : p.name) === profileName
|
|
320
|
+
);
|
|
321
|
+
if (!exists) {
|
|
322
|
+
currentProfiles.push(entry);
|
|
317
323
|
}
|
|
318
324
|
}
|
|
319
325
|
}
|
|
@@ -88,6 +88,7 @@ export function registerDiscourseCommands(program: Command): void {
|
|
|
88
88
|
.command('add')
|
|
89
89
|
.description('Add a new Discourse profile')
|
|
90
90
|
.option('--profile <name>', 'Profile name (auto-detected from username if not provided)')
|
|
91
|
+
.option('--read-only', 'Create as read-only profile (blocks write operations)')
|
|
91
92
|
.action(async (options) => {
|
|
92
93
|
try {
|
|
93
94
|
console.error('\nDiscourse Setup\n');
|
|
@@ -173,10 +174,13 @@ export function registerDiscourseCommands(program: Command): void {
|
|
|
173
174
|
const profileName = options.profile || username.trim();
|
|
174
175
|
|
|
175
176
|
// Save credentials
|
|
176
|
-
await setProfile('discourse', profileName);
|
|
177
|
+
await setProfile('discourse', profileName, { readOnly: options.readOnly });
|
|
177
178
|
await setCredentials('discourse', profileName, credentials);
|
|
178
179
|
|
|
179
180
|
console.log(`\nProfile "${profileName}" configured!`);
|
|
181
|
+
if (options.readOnly) {
|
|
182
|
+
console.log(` Access: read-only`);
|
|
183
|
+
}
|
|
180
184
|
console.log(` Test with: agentio discourse list --profile ${profileName}`);
|
|
181
185
|
} catch (error) {
|
|
182
186
|
handleError(error);
|