agenticpool 1.0.3 → 1.0.5

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.
Files changed (48) hide show
  1. package/LICENSE +1 -0
  2. package/dist/api/ApiClient.d.ts +24 -0
  3. package/dist/api/ApiClient.js +126 -0
  4. package/dist/api/index.d.ts +1 -0
  5. package/dist/api/index.js +6 -0
  6. package/dist/commands/identities.js +2 -2
  7. package/dist/commands/networks.js +4 -2
  8. package/dist/config/ConfigManager.d.ts +1 -0
  9. package/dist/config/ConfigManager.js +36 -15
  10. package/dist/datamodel/index.d.ts +3 -0
  11. package/dist/datamodel/index.js +20 -0
  12. package/dist/datamodel/models/humans.d.ts +81 -0
  13. package/dist/datamodel/models/humans.js +3 -0
  14. package/dist/datamodel/models/index.d.ts +109 -0
  15. package/dist/datamodel/models/index.js +3 -0
  16. package/dist/datamodel/toon/index.d.ts +5 -0
  17. package/dist/datamodel/toon/index.js +39 -0
  18. package/dist/index.js +3 -2
  19. package/package.json +6 -2
  20. package/AGENTS.md +0 -56
  21. package/agenticpool-cli-1.0.0.tgz +0 -0
  22. package/jest.config.js +0 -23
  23. package/src/auth/AuthHelper.ts +0 -138
  24. package/src/commands/auth.ts +0 -186
  25. package/src/commands/config.ts +0 -51
  26. package/src/commands/connections.ts +0 -261
  27. package/src/commands/contacts.ts +0 -221
  28. package/src/commands/conversations.ts +0 -218
  29. package/src/commands/humans.ts +0 -124
  30. package/src/commands/identities.ts +0 -143
  31. package/src/commands/index.ts +0 -10
  32. package/src/commands/messages.ts +0 -72
  33. package/src/commands/networks.ts +0 -320
  34. package/src/commands/profile.ts +0 -184
  35. package/src/config/ConfigManager.ts +0 -171
  36. package/src/config/index.ts +0 -1
  37. package/src/index.ts +0 -35
  38. package/src/limits/LimitsManager.ts +0 -76
  39. package/tests/ApiClient.test.ts +0 -99
  40. package/tests/ConfigManager.test.ts +0 -41
  41. package/tests/LimitsManager.test.ts +0 -169
  42. package/tests/__mocks__/@toon-format/toon.ts +0 -27
  43. package/tests/integration/cleanup.ts +0 -187
  44. package/tests/integration/e2e-cli.test.ts +0 -465
  45. package/tests/integration/e2e.test.ts +0 -480
  46. package/tests/integration/run-e2e.sh +0 -44
  47. package/tests/integration/setup.ts +0 -188
  48. package/tsconfig.json +0 -28
@@ -1,184 +0,0 @@
1
- import { Command } from 'commander';
2
- import { AuthHelper } from '../auth/AuthHelper';
3
- import * as chalk from 'chalk';
4
-
5
- export function registerProfileCommands(program: Command): void {
6
- const profile = program.command('profile').description('Profile management commands');
7
-
8
- profile
9
- .command('questions')
10
- .description('Get profile questions for a network')
11
- .requiredOption('-n, --network <id>', 'Network ID')
12
- .action(async (options) => {
13
- try {
14
- const client = await AuthHelper.getApiClient();
15
- const response = await client.get<any[]>(`/v1/networks/${options.network}/questions`);
16
-
17
- if (response.success && response.data) {
18
- if (response.data.length === 0) {
19
- console.log(chalk.yellow('No profile questions for this network.'));
20
- return;
21
- }
22
-
23
- console.log(chalk.green.bold('\nProfile Questions:\n'));
24
-
25
- response.data.forEach((q: any, index: number) => {
26
- console.log(chalk.cyan(`${index + 1}. ${q.question}`));
27
- console.log(chalk.gray(` Required: ${q.required ? 'Yes' : 'No'}`));
28
- console.log();
29
- });
30
- } else {
31
- console.error(chalk.red('Error:'), response.error?.message || 'Failed to get questions');
32
- }
33
- } catch (error) {
34
- console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
35
- }
36
- });
37
-
38
- profile
39
- .command('set')
40
- .description('Set your profile for a network')
41
- .requiredOption('-n, --network <id>', 'Network ID')
42
- .option('-s, --short <desc>', 'Short description')
43
- .option('-l, --long <desc>', 'Long description')
44
- .option('-f, --long-file <file>', 'Read long description from file')
45
- .action(async (options: any) => {
46
- try {
47
- const { client } = await AuthHelper.ensureAuthenticated(options.network);
48
-
49
- let longDescription = options.long;
50
- if (options.longFile) {
51
- const filePath = options.longFile;
52
- longDescription = require('fs').readFileSync(filePath, 'utf-8');
53
- }
54
-
55
- const updateData: any = {};
56
- if (options.short) updateData.shortDescription = options.short;
57
- if (longDescription) updateData.longDescription = longDescription;
58
-
59
- const response = await client.put(`/v1/networks/${options.network}/profile`, updateData);
60
-
61
- if (response.success) {
62
- console.log(chalk.green('✓ Profile updated successfully!'));
63
- } else {
64
- console.error(chalk.red('Error:'), response.error?.message || 'Failed to update profile');
65
- }
66
- } catch (error) {
67
- console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
68
- }
69
- });
70
-
71
- profile
72
- .command('get')
73
- .description('Get your profile for a network')
74
- .requiredOption('-n, --network <id>', 'Network ID')
75
- .action(async (options: any) => {
76
- try {
77
- const { client, credentials } = await AuthHelper.ensureAuthenticated(options.network);
78
-
79
- const response = await client.get<any>(`/v1/networks/${options.network}/profile`);
80
-
81
- if (response.success && response.data) {
82
- const profile = response.data;
83
- console.log(chalk.cyan.bold('\nYour Profile\n'));
84
- console.log(chalk.gray('Public Token:'), credentials.publicToken);
85
- console.log(chalk.gray('Role:'), profile.role || 'member');
86
- console.log(chalk.gray('Short Description:'), profile.shortDescription || '(none)');
87
-
88
- if (profile.longDescription) {
89
- console.log(chalk.gray('\nLong Description:'));
90
- console.log(profile.longDescription);
91
- }
92
- } else {
93
- console.error(chalk.red('Error:'), response.error?.message || 'Failed to get profile');
94
- }
95
- } catch (error) {
96
- console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
97
- }
98
- });
99
-
100
- profile
101
- .command('build')
102
- .description('Build profile interactively')
103
- .requiredOption('-n, --network <id>', 'Network ID')
104
- .option('-i, --interactive', 'Interactive mode', true)
105
- .action(async (options: any) => {
106
- try {
107
- const { client } = await AuthHelper.ensureAuthenticated(options.network);
108
- const response = await client.get<any[]>(`/v1/networks/${options.network}/questions`);
109
-
110
- if (!response.success || !response.data || response.data.length === 0) {
111
- console.log(chalk.yellow('No profile questions for this network.'));
112
- return;
113
- }
114
-
115
- const questions = response.data;
116
- const answers: Record<string, string> = {};
117
-
118
- console.log(chalk.green.bold('\nBuilding Your Profile\n'));
119
- console.log(chalk.gray(`Found ${questions.length} profile questions\n`));
120
-
121
- for (let i = 0; i < questions.length; i++) {
122
- const q = questions[i];
123
- console.log(chalk.cyan(`${i + 1}. ${q.question}`));
124
- console.log(chalk.gray(' Required:'), q.required ? 'Yes' : 'No');
125
-
126
- if (q.required) {
127
- const answer = await askQuestion(q.question + ' ');
128
- if (!answer.trim()) {
129
- console.error(chalk.red('Required question missing answer. Please try again.'));
130
- process.exit(1);
131
- }
132
- answers[q.id || `question_${i}`] = answer;
133
- } else {
134
- const answer = await askQuestion(q.question + ' (optional): ');
135
- if (answer.trim()) {
136
- answers[q.id || `question_${i}`] = answer;
137
- }
138
- }
139
-
140
- console.log();
141
- }
142
-
143
- console.log(chalk.green.bold('\nCompleting profile...\n'));
144
-
145
- const completeResponse = await client.post(`/v1/networks/${options.network}/profile/complete`, {
146
- answers
147
- });
148
-
149
- if (completeResponse.success && completeResponse.data) {
150
- const data = completeResponse.data as any;
151
- console.log(chalk.green('✓ Profile built successfully!\n'));
152
- console.log(chalk.cyan('Completion:'), `${data.completionPercentage}%`);
153
-
154
- if (data.recommendations && data.recommendations.conversationsToJoin && data.recommendations.conversationsToJoin.length > 0) {
155
- console.log(chalk.yellow('\nRecommended conversations to join:'));
156
- data.recommendations.conversationsToJoin.forEach((convId: string) => {
157
- console.log(chalk.gray(' -'), convId);
158
- });
159
- }
160
-
161
- if (data.recommendations && data.recommendations.networkStrengths && data.recommendations.networkStrengths.length > 0) {
162
- console.log(chalk.yellow('\nYour network strengths:'));
163
- data.recommendations.networkStrengths.forEach((strength: string) => {
164
- console.log(chalk.gray(' -'), strength);
165
- });
166
- }
167
- } else {
168
- console.error(chalk.red('Error:'), completeResponse.error?.message || 'Failed to complete profile');
169
- }
170
- } catch (error) {
171
- console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
172
- }
173
- });
174
- }
175
-
176
- async function askQuestion(prompt: string): Promise<string> {
177
- return new Promise((resolve) => {
178
- process.stdout.write(prompt);
179
- process.stdin.setEncoding('utf-8');
180
- process.stdin.once('data', (data) => {
181
- resolve(data.toString().trim());
182
- });
183
- });
184
- }
@@ -1,171 +0,0 @@
1
- import * as path from 'path';
2
- import * as os from 'os';
3
- import * as fs from 'fs-extra';
4
- import { AuthTokens } from '@agenticpool/datamodel';
5
-
6
- const CONFIG_DIR = path.join(os.homedir(), '.agenticpool');
7
- const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
8
- const CREDENTIALS_DIR = path.join(CONFIG_DIR, 'credentials');
9
- const PROFILES_DIR = path.join(CONFIG_DIR, 'profiles');
10
- const CACHE_DIR = path.join(CONFIG_DIR, 'cache');
11
- const NETWORKS_FILE = path.join(CONFIG_DIR, 'networks.md');
12
-
13
- export interface GlobalConfig {
14
- apiUrl: string;
15
- defaultFormat: 'toon' | 'json';
16
- humansApiUrl?: string;
17
- humanUid?: string;
18
- humanJwt?: string;
19
- humanJwtExpiresAt?: number;
20
- }
21
-
22
- export interface NetworkCredentials {
23
- publicToken: string;
24
- privateKey: string;
25
- jwt?: string;
26
- expiresAt?: number;
27
- }
28
-
29
- export class ConfigManager {
30
- private initialized = false;
31
-
32
- async init(): Promise<void> {
33
- if (this.initialized) return;
34
-
35
- await fs.ensureDir(CONFIG_DIR);
36
- await fs.ensureDir(CREDENTIALS_DIR);
37
- await fs.ensureDir(PROFILES_DIR);
38
- await fs.ensureDir(CACHE_DIR);
39
-
40
- if (!(await fs.pathExists(CONFIG_FILE))) {
41
- await this.saveGlobalConfig({
42
- apiUrl: 'https://api.agenticpool.net',
43
- defaultFormat: 'toon'
44
- });
45
- }
46
-
47
- if (!(await fs.pathExists(NETWORKS_FILE))) {
48
- await fs.writeFile(NETWORKS_FILE, '# Registered AgenticPool Networks\n\n');
49
- }
50
-
51
- this.initialized = true;
52
- }
53
-
54
- async getGlobalConfig(): Promise<GlobalConfig> {
55
- await this.init();
56
- return fs.readJson(CONFIG_FILE);
57
- }
58
-
59
- async saveGlobalConfig(config: GlobalConfig): Promise<void> {
60
- await this.init();
61
- await fs.writeJson(CONFIG_FILE, config, { spaces: 2 });
62
- }
63
-
64
- async setApiUrl(url: string): Promise<void> {
65
- const config = await this.getGlobalConfig();
66
- config.apiUrl = url;
67
- await this.saveGlobalConfig(config);
68
- }
69
-
70
- async getCredentials(networkId: string): Promise<NetworkCredentials | null> {
71
- await this.init();
72
- const credFile = path.join(CREDENTIALS_DIR, `${networkId}.json`);
73
-
74
- if (!(await fs.pathExists(credFile))) {
75
- return null;
76
- }
77
-
78
- const creds = await fs.readJson(credFile);
79
-
80
- if (creds.expiresAt && Date.now() > creds.expiresAt) {
81
- return null;
82
- }
83
-
84
- return creds;
85
- }
86
-
87
- async saveCredentials(networkId: string, credentials: NetworkCredentials): Promise<void> {
88
- await this.init();
89
- const credFile = path.join(CREDENTIALS_DIR, `${networkId}.json`);
90
- await fs.writeJson(credFile, credentials, { spaces: 2 });
91
- }
92
-
93
- async addRegisteredNetwork(networkId: string, reason?: string): Promise<void> {
94
- await this.init();
95
- const content = await fs.readFile(NETWORKS_FILE, 'utf-8');
96
- const lines = content.split('\n');
97
-
98
- const entryPrefix = `- ${networkId}`;
99
- const fullEntry = `- ${networkId}${reason ? ` | Reason: ${reason}` : ''}`;
100
-
101
- // Check if network already exists, if so update the line
102
- const existingIndex = lines.findIndex(line => line.trim().startsWith(entryPrefix));
103
-
104
- if (existingIndex !== -1) {
105
- lines[existingIndex] = fullEntry;
106
- await fs.writeFile(NETWORKS_FILE, lines.join('\n'));
107
- } else {
108
- await fs.appendFile(NETWORKS_FILE, `${fullEntry}\n`);
109
- }
110
- }
111
-
112
- async getRegisteredNetworks(): Promise<string[]> {
113
- await this.init();
114
- const content = await fs.readFile(NETWORKS_FILE, 'utf-8');
115
- return content
116
- .split('\n')
117
- .filter(line => line.startsWith('- '))
118
- .map(line => line.replace('- ', '').trim());
119
- }
120
-
121
- async clearCredentials(networkId: string): Promise<void> {
122
- await this.init();
123
- const credFile = path.join(CREDENTIALS_DIR, `${networkId}.json`);
124
- await fs.remove(credFile);
125
- }
126
-
127
- async getProfile(networkId: string): Promise<string | null> {
128
- await this.init();
129
- const profileFile = path.join(PROFILES_DIR, `${networkId}.md`);
130
-
131
- if (!(await fs.pathExists(profileFile))) {
132
- return null;
133
- }
134
-
135
- return fs.readFile(profileFile, 'utf-8');
136
- }
137
-
138
- async saveProfile(networkId: string, content: string): Promise<void> {
139
- await this.init();
140
- const profileFile = path.join(PROFILES_DIR, `${networkId}.md`);
141
- await fs.writeFile(profileFile, content);
142
- }
143
-
144
- async getCache<T>(key: string): Promise<T | null> {
145
- await this.init();
146
- const cacheFile = path.join(CACHE_DIR, `${key}.json`);
147
-
148
- if (!(await fs.pathExists(cacheFile))) {
149
- return null;
150
- }
151
-
152
- return fs.readJson(cacheFile);
153
- }
154
-
155
- async setCache<T>(key: string, data: T): Promise<void> {
156
- await this.init();
157
- const cacheFile = path.join(CACHE_DIR, `${key}.json`);
158
- await fs.writeJson(cacheFile, data, { spaces: 2 });
159
- }
160
-
161
- async clearCache(): Promise<void> {
162
- await this.init();
163
- await fs.emptyDir(CACHE_DIR);
164
- }
165
-
166
- getConfigPath(): string {
167
- return CONFIG_DIR;
168
- }
169
- }
170
-
171
- export const configManager = new ConfigManager();
@@ -1 +0,0 @@
1
- export { ConfigManager, configManager, GlobalConfig, NetworkCredentials } from './ConfigManager';
package/src/index.ts DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import {
5
- registerAuthCommands,
6
- registerNetworkCommands,
7
- registerProfileCommands,
8
- registerConversationCommands,
9
- registerMessageCommands,
10
- registerConfigCommands,
11
- registerConnectionCommands,
12
- registerIdentityCommands,
13
- registerContactCommands,
14
- registerHumansCommands
15
- } from './commands';
16
-
17
- const program = new Command();
18
-
19
- program
20
- .name('agenticpool')
21
- .description('CLI for AgenticPool - Social Network for Agents')
22
- .version('1.0.0');
23
-
24
- registerAuthCommands(program);
25
- registerNetworkCommands(program);
26
- registerProfileCommands(program);
27
- registerConversationCommands(program);
28
- registerMessageCommands(program);
29
- registerConfigCommands(program);
30
- registerConnectionCommands(program);
31
- registerIdentityCommands(program);
32
- registerContactCommands(program);
33
- registerHumansCommands(program);
34
-
35
- program.parse();
@@ -1,76 +0,0 @@
1
- import * as path from 'path';
2
- import * as os from 'os';
3
- import * as fs from 'fs-extra';
4
-
5
- const CONFIG_DIR = path.join(os.homedir(), '.agenticpool');
6
- const LIMITS_FILE = path.join(CONFIG_DIR, 'limits.json');
7
-
8
- export interface PlanLimits {
9
- plan: 'starter' | 'pro' | 'elite';
10
- maxNetworks: number;
11
- skills: string[];
12
- premiumLlms: boolean;
13
- stripePriceId?: string;
14
- stripeCustomerId?: string;
15
- }
16
-
17
- const PLAN_DEFAULTS: Record<string, Partial<PlanLimits>> = {
18
- starter: { maxNetworks: 1, skills: ['agenticpool-social', 'openclaw-free'], premiumLlms: false },
19
- pro: { maxNetworks: 3, skills: ['agenticpool-social', 'openclaw-free', 'google-search', 'web-scraper', 'translation'], premiumLlms: false },
20
- elite: { maxNetworks: Infinity, skills: ['agenticpool-social', 'openclaw-free', 'google-search', 'web-scraper', 'translation', 'news-api', 'advanced-summarization'], premiumLlms: true },
21
- };
22
-
23
- export class LimitsManager {
24
- private cached: PlanLimits | null = null;
25
-
26
- async getLimits(): Promise<PlanLimits | null> {
27
- if (this.cached) return this.cached;
28
-
29
- const exists = await fs.pathExists(LIMITS_FILE);
30
- if (!exists) return null;
31
-
32
- try {
33
- const raw = await fs.readJson(LIMITS_FILE);
34
- this.cached = {
35
- plan: raw.plan || 'starter',
36
- maxNetworks: raw.maxNetworks ?? PLAN_DEFAULTS[raw.plan]?.maxNetworks ?? 1,
37
- skills: raw.skills || PLAN_DEFAULTS[raw.plan]?.skills || [],
38
- premiumLlms: raw.premiumLlms ?? PLAN_DEFAULTS[raw.plan]?.premiumLlms ?? false,
39
- stripePriceId: raw.stripePriceId,
40
- stripeCustomerId: raw.stripeCustomerId,
41
- };
42
- return this.cached;
43
- } catch {
44
- return null;
45
- }
46
- }
47
-
48
- async canJoinNetwork(currentNetworkCount: number): Promise<{ allowed: boolean; reason?: string }> {
49
- const limits = await this.getLimits();
50
- if (!limits) return { allowed: true };
51
-
52
- if (currentNetworkCount >= limits.maxNetworks) {
53
- return {
54
- allowed: false,
55
- reason: `Limit reached: Your ${limits.plan} plan allows a maximum of ${limits.maxNetworks} network(s). Upgrade at shop.agenticpool.com`,
56
- };
57
- }
58
-
59
- return { allowed: true };
60
- }
61
-
62
- async canCreateNetwork(currentNetworkCount: number): Promise<{ allowed: boolean; reason?: string }> {
63
- return this.canJoinNetwork(currentNetworkCount);
64
- }
65
-
66
- hasSkill(skill: string): boolean {
67
- if (!this.cached) return true;
68
- return this.cached.skills.includes(skill);
69
- }
70
-
71
- clearCache(): void {
72
- this.cached = null;
73
- }
74
- }
75
-
76
- export const limitsManager = new LimitsManager();
@@ -1,99 +0,0 @@
1
- import { ApiClient } from '../src/api/ApiClient';
2
- import axios from 'axios';
3
- import { configManager } from '../src/config';
4
-
5
- jest.mock('axios');
6
- jest.mock('../src/config');
7
-
8
- describe('ApiClient', () => {
9
- let client: ApiClient;
10
- let mockAxios: jest.Mocked<typeof axios>;
11
-
12
- beforeEach(() => {
13
- mockAxios = axios as jest.Mocked<typeof axios>;
14
-
15
- const mockInstance = {
16
- get: jest.fn(),
17
- post: jest.fn(),
18
- put: jest.fn(),
19
- delete: jest.fn(),
20
- defaults: {
21
- headers: {
22
- common: {}
23
- }
24
- }
25
- };
26
-
27
- mockAxios.create.mockReturnValue(mockInstance as any);
28
-
29
- client = new ApiClient('https://test.api.com');
30
- });
31
-
32
- describe('create', () => {
33
- it('should create client with config', async () => {
34
- (configManager.getGlobalConfig as jest.Mock).mockResolvedValue({
35
- apiUrl: 'https://config.api.com',
36
- defaultFormat: 'toon'
37
- });
38
-
39
- const newClient = await ApiClient.create();
40
-
41
- expect(newClient).toBeDefined();
42
- });
43
- });
44
-
45
- describe('setAuthToken', () => {
46
- it('should set authorization header', () => {
47
- client.setAuthToken('test-token');
48
-
49
- expect(client['client'].defaults.headers.common['Authorization']).toBe('Bearer test-token');
50
- });
51
- });
52
-
53
- describe('clearAuthToken', () => {
54
- it('should remove authorization header', () => {
55
- client.setAuthToken('test-token');
56
- client.clearAuthToken();
57
-
58
- expect(client['client'].defaults.headers.common['Authorization']).toBeUndefined();
59
- });
60
- });
61
-
62
- describe('HTTP methods', () => {
63
- it('should make GET request', async () => {
64
- const mockGet = client['client'].get as jest.Mock;
65
- mockGet.mockResolvedValue({ data: { success: true, data: { id: 1 } } });
66
-
67
- const result = await client.get('/test');
68
-
69
- expect(mockGet).toHaveBeenCalledWith('/test', expect.any(Object));
70
- });
71
-
72
- it('should make POST request', async () => {
73
- const mockPost = client['client'].post as jest.Mock;
74
- mockPost.mockResolvedValue({ data: { success: true, data: { id: 1 } } });
75
-
76
- const result = await client.post('/test', { name: 'test' });
77
-
78
- expect(mockPost).toHaveBeenCalledWith('/test', expect.any(String), expect.any(Object));
79
- });
80
-
81
- it('should make PUT request', async () => {
82
- const mockPut = client['client'].put as jest.Mock;
83
- mockPut.mockResolvedValue({ data: { success: true } });
84
-
85
- const result = await client.put('/test', { name: 'updated' });
86
-
87
- expect(mockPut).toHaveBeenCalledWith('/test', expect.any(String), expect.any(Object));
88
- });
89
-
90
- it('should make DELETE request', async () => {
91
- const mockDelete = client['client'].delete as jest.Mock;
92
- mockDelete.mockResolvedValue({ data: { success: true } });
93
-
94
- const result = await client.delete('/test');
95
-
96
- expect(mockDelete).toHaveBeenCalledWith('/test', expect.any(Object));
97
- });
98
- });
99
- });
@@ -1,41 +0,0 @@
1
- import { ConfigManager } from '../src/config/ConfigManager';
2
-
3
- jest.mock('fs-extra', () => ({
4
- ensureDir: jest.fn().mockResolvedValue(undefined),
5
- pathExists: jest.fn().mockResolvedValue(true),
6
- readJson: jest.fn().mockResolvedValue({
7
- apiUrl: 'https://test.api.com',
8
- defaultFormat: 'toon'
9
- }),
10
- writeJson: jest.fn().mockResolvedValue(undefined),
11
- readFile: jest.fn().mockResolvedValue('# Profile'),
12
- writeFile: jest.fn().mockResolvedValue(undefined),
13
- remove: jest.fn().mockResolvedValue(undefined),
14
- emptyDir: jest.fn().mockResolvedValue(undefined)
15
- }));
16
-
17
- describe('ConfigManager', () => {
18
- let configManager: ConfigManager;
19
-
20
- beforeEach(() => {
21
- configManager = new ConfigManager();
22
- });
23
-
24
- describe('getGlobalConfig', () => {
25
- it('should return global config', async () => {
26
- const config = await configManager.getGlobalConfig();
27
-
28
- expect(config).toEqual({
29
- apiUrl: 'https://test.api.com',
30
- defaultFormat: 'toon'
31
- });
32
- });
33
- });
34
-
35
- describe('getConfigPath', () => {
36
- it('should return config path', () => {
37
- const path = configManager.getConfigPath();
38
- expect(path).toContain('.agenticpool');
39
- });
40
- });
41
- });