@majkapp/majk-chat-cli 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -51,36 +51,50 @@ npm install @majkapp/majk-chat-cli
51
51
  ### Basic Chat
52
52
 
53
53
  ```bash
54
- # Send a simple message
54
+ # Send a simple message (uses default profile)
55
55
  majk-chat chat -M "Hello, how are you?"
56
56
 
57
- # Use a specific provider
58
- majk-chat chat -p anthropic -M "Explain quantum computing"
57
+ # Use a specific provider with work profile
58
+ majk-chat chat -p anthropic --profile work -M "Explain quantum computing"
59
59
 
60
- # Use a specific model
61
- majk-chat chat -m gpt-4 -M "Write a haiku"
60
+ # Use a specific model with personal profile
61
+ majk-chat chat -m gpt-4 --profile personal -M "Write a haiku"
62
+ ```
63
+
64
+ ### Profile Setup (First Time)
65
+
66
+ ```bash
67
+ # Set up your API keys with profiles
68
+ majk-chat set-key --openai sk-your-openai-key --profile default
69
+ majk-chat set-key --anthropic sk-ant-your-anthropic-key --profile work
70
+
71
+ # Test your setup
72
+ majk-chat test-all-profiles
73
+
74
+ # Start chatting
75
+ majk-chat chat --profile work -M "Hello, I'm using my work profile!"
62
76
  ```
63
77
 
64
78
  ### Interactive Mode
65
79
 
66
80
  ```bash
67
- # Start interactive chat
81
+ # Start interactive chat with default profile
68
82
  majk-chat interactive
69
83
 
70
- # With specific provider and model
71
- majk-chat interactive -p openai -m gpt-4
84
+ # With specific profile and provider
85
+ majk-chat interactive --profile work -p anthropic -m claude-3-sonnet
72
86
 
73
- # With tools enabled
74
- majk-chat interactive --tools --auto-execute
87
+ # With tools enabled using production profile
88
+ majk-chat interactive --tools --auto-execute --profile production
75
89
  ```
76
90
 
77
91
  ### Session Management
78
92
 
79
93
  ```bash
80
- # Create a session with title
81
- majk-chat chat --save-session --session-title "Web Development" -M "Help me build a React app"
94
+ # Create a session with title and profile
95
+ majk-chat chat --save-session --session-title "Web Development" --profile work -M "Help me build a React app"
82
96
 
83
- # Continue the most recent session
97
+ # Continue the most recent session (inherits profile)
84
98
  majk-chat chat --continue -M "Add user authentication"
85
99
 
86
100
  # List all sessions in current directory
@@ -117,6 +131,7 @@ majk-chat chat [options]
117
131
  - `--tool-result-limit <limit>` - Truncate tool results over this character limit (default: 8000)
118
132
  - `--max-steps <steps>` - Maximum tool execution steps
119
133
  - `-c, --config <file>` - Configuration file
134
+ - `--profile <name>` - Use specific profile for credentials (default: "default")
120
135
  - `--api-key <key>` - API key (overrides environment)
121
136
  - `--api-key-file <file>` - Read API key from file
122
137
 
@@ -132,28 +147,31 @@ majk-chat chat [options]
132
147
  #### Examples
133
148
 
134
149
  ```bash
135
- # Simple message
150
+ # Simple message with default profile
136
151
  majk-chat chat -M "What is the capital of France?"
137
152
 
138
- # With system message
139
- majk-chat chat -s "You are a helpful assistant" -M "Hello"
153
+ # Use specific profile
154
+ majk-chat chat --profile work -M "Hello from work environment"
155
+
156
+ # With system message and profile
157
+ majk-chat chat -s "You are a helpful assistant" --profile personal -M "Hello"
140
158
 
141
- # Read from file
142
- majk-chat chat -f prompt.txt
159
+ # Read from file with specific profile
160
+ majk-chat chat -f prompt.txt --profile production
143
161
 
144
- # With specific model and temperature
145
- majk-chat chat -m gpt-4 -t 0.7 -M "Write a creative story"
162
+ # With specific model and temperature using work profile
163
+ majk-chat chat -m claude-3-sonnet -t 0.7 --profile work -M "Write a creative story"
146
164
 
147
- # Enable tools
148
- majk-chat chat --tools -M "Create a file called test.txt with 'Hello World' in it"
165
+ # Enable tools with profile
166
+ majk-chat chat --tools --profile default -M "Create a file called test.txt with 'Hello World' in it"
149
167
 
150
- # JSON output
151
- majk-chat chat -j -M "Hello" > response.json
168
+ # JSON output with profile
169
+ majk-chat chat -j --profile work -M "Hello" > response.json
152
170
 
153
- # Create a session
154
- majk-chat chat --save-session --session-title "Code Review" -M "Review this Python function"
171
+ # Create a session with profile
172
+ majk-chat chat --save-session --session-title "Code Review" --profile work -M "Review this Python function"
155
173
 
156
- # Continue a session
174
+ # Continue a session (inherits profile from saved session)
157
175
  majk-chat chat --continue -M "Fix the performance issues"
158
176
 
159
177
  # List sessions
@@ -180,6 +198,7 @@ majk-chat interactive [options]
180
198
  - `--tool-result-limit <limit>` - Truncate tool results over this character limit (default: 8000)
181
199
  - `--auto-execute` - Auto-execute tools without confirmation
182
200
  - `-c, --config <file>` - Configuration file
201
+ - `--profile <name>` - Use specific profile for credentials (default: "default")
183
202
 
184
203
  #### Interactive Commands
185
204
 
@@ -201,14 +220,14 @@ Once in interactive mode, you can use these commands:
201
220
  #### Examples
202
221
 
203
222
  ```bash
204
- # Start interactive mode
223
+ # Start interactive mode with default profile
205
224
  majk-chat interactive
206
225
 
207
- # With specific configuration
208
- majk-chat interactive -p anthropic -m claude-3-sonnet
226
+ # With specific profile and provider
227
+ majk-chat interactive --profile work -p anthropic -m claude-3-sonnet
209
228
 
210
- # With tools enabled
211
- majk-chat interactive --tools
229
+ # With tools and specific profile
230
+ majk-chat interactive --tools --profile production
212
231
 
213
232
  You> /help
214
233
  [Shows available commands]
@@ -243,15 +262,19 @@ majk-chat models [options]
243
262
 
244
263
  - `-p, --provider <provider>` - Filter by provider
245
264
  - `-c, --config <file>` - Configuration file
265
+ - `--profile <name>` - Use specific profile for credentials
246
266
 
247
267
  #### Examples
248
268
 
249
269
  ```bash
250
- # List all models
270
+ # List all models using default profile
251
271
  majk-chat models
252
272
 
253
- # List models for specific provider
254
- majk-chat models -p openai
273
+ # List models for specific provider using work profile
274
+ majk-chat models -p anthropic --profile work
275
+
276
+ # List models for specific profile
277
+ majk-chat models --profile production
255
278
  ```
256
279
 
257
280
  ### `config` - Configure providers and credentials
@@ -283,6 +306,120 @@ majk-chat config --get providers.openai.apiKey
283
306
  majk-chat config --list
284
307
  ```
285
308
 
309
+ ### Profile Configuration Commands
310
+
311
+ #### `configure-provider` - Interactive provider setup
312
+
313
+ ```bash
314
+ majk-chat configure-provider <provider> [options]
315
+ ```
316
+
317
+ **Arguments:**
318
+ - `<provider>` - Provider to configure (openai, anthropic, azure-openai, bedrock)
319
+
320
+ **Options:**
321
+ - `--profile <name>` - Profile name (default: "default")
322
+ - `--skip-validation` - Skip API key validation
323
+
324
+ **Examples:**
325
+ ```bash
326
+ # Interactive OpenAI setup with validation
327
+ majk-chat configure-provider openai
328
+
329
+ # Set up Anthropic for work profile
330
+ majk-chat configure-provider anthropic --profile work
331
+
332
+ # Set up Azure OpenAI without validation
333
+ majk-chat configure-provider azure-openai --profile production --skip-validation
334
+ ```
335
+
336
+ #### `set-key` - Direct credential configuration
337
+
338
+ ```bash
339
+ majk-chat set-key [options]
340
+ ```
341
+
342
+ **Options:**
343
+ - `--openai <key>` - OpenAI API key
344
+ - `--anthropic <key>` - Anthropic API key
345
+ - `--azure-openai <key> <endpoint> <deployment>` - Azure OpenAI credentials
346
+ - `--bedrock <accessKey> <secretKey> [region]` - AWS Bedrock credentials
347
+ - `--profile <name>` - Profile to store configuration in (default: "default")
348
+ - `--skip-validation` - Skip API key validation
349
+
350
+ **Examples:**
351
+ ```bash
352
+ # Set OpenAI key for default profile
353
+ majk-chat set-key --openai sk-your-key
354
+
355
+ # Set Anthropic key for work profile
356
+ majk-chat set-key --anthropic sk-ant-key --profile work
357
+
358
+ # Set Azure OpenAI (all parameters required)
359
+ majk-chat set-key --azure-openai key https://endpoint.com deployment --profile prod
360
+
361
+ # Set Bedrock with region
362
+ majk-chat set-key --bedrock access-key secret-key us-west-2 --profile aws
363
+ ```
364
+
365
+ #### `list-profiles` - Show configured profiles
366
+
367
+ ```bash
368
+ majk-chat list-profiles
369
+ ```
370
+
371
+ **Example output:**
372
+ ```
373
+ Configured profiles:
374
+ default (openai, anthropic)
375
+ work (anthropic, azure-openai)
376
+ aws-prod (bedrock)
377
+ ```
378
+
379
+ #### `delete-profile` - Remove a profile
380
+
381
+ ```bash
382
+ majk-chat delete-profile <name>
383
+ ```
384
+
385
+ **Examples:**
386
+ ```bash
387
+ majk-chat delete-profile old-work-profile
388
+ ```
389
+
390
+ #### Profile Testing Commands
391
+
392
+ ##### `test-profile` - Test all providers in a profile
393
+ ```bash
394
+ majk-chat test-profile <name>
395
+ ```
396
+
397
+ ##### `test-all-profiles` - Test all profiles
398
+ ```bash
399
+ majk-chat test-all-profiles
400
+ ```
401
+
402
+ ##### `test-provider` - Test specific provider in profile
403
+ ```bash
404
+ majk-chat test-provider <provider> [--profile <name>]
405
+ ```
406
+
407
+ **Examples:**
408
+ ```bash
409
+ # Test work profile
410
+ majk-chat test-profile work
411
+ # Output:
412
+ # Testing profile: work
413
+ # ✓ anthropic (model: claude-3-5-sonnet-20241022)
414
+ # ✗ azure-openai - Invalid endpoint
415
+
416
+ # Test all profiles
417
+ majk-chat test-all-profiles
418
+
419
+ # Test specific provider
420
+ majk-chat test-provider openai --profile default
421
+ ```
422
+
286
423
  ## Core Tools Usage
287
424
 
288
425
  The `--enable-core-tools` flag provides access to a comprehensive set of tools for file system operations, process management, and utility functions:
@@ -306,25 +443,112 @@ The `--enable-core-tools` flag provides access to a comprehensive set of tools f
306
443
  ### Basic Usage
307
444
 
308
445
  ```bash
309
- # Enable core tools with basic usage
446
+ # Enable core tools with basic usage (uses default profile)
310
447
  majk-chat chat -M "List all JavaScript files in the src directory" --enable-core-tools
311
448
 
312
- # Enable with custom result limit (default: 8000 chars)
313
- majk-chat chat -M "Show me the contents of package.json" --enable-core-tools --tool-result-limit 4000
449
+ # Enable with custom result limit using work profile
450
+ majk-chat chat -M "Show me the contents of package.json" --enable-core-tools --tool-result-limit 4000 --profile work
451
+
452
+ # Filter specific tools (only allow file operations) with production profile
453
+ majk-chat chat -M "Read and analyze config files" --enable-core-tools --allowed-tools "ls,read,glob,grep" --profile production
454
+
455
+ # Exclude potentially dangerous tools using personal profile
456
+ majk-chat chat -M "Analyze the codebase" --enable-core-tools --disallowed-tools "bash,kill_bash,web_fetch" --profile personal
457
+ ```
458
+
459
+ ### 🔍 Dry Run Mode
314
460
 
315
- # Filter specific tools (only allow file operations)
316
- majk-chat chat -M "Read and analyze config files" --enable-core-tools --allowed-tools "ls,read,glob,grep"
461
+ Preview and approve tool operations before execution for safe testing and verification:
317
462
 
318
- # Exclude potentially dangerous tools
319
- majk-chat chat -M "Analyze the codebase" --enable-core-tools --disallowed-tools "bash,kill_bash,web_fetch"
463
+ ```bash
464
+ # Preview mode - see what would happen without executing
465
+ majk-chat chat --dry-run --enable-core-tools -M "Refactor this codebase and add tests"
466
+
467
+ # Interactive review mode - approve/reject each operation
468
+ majk-chat chat --dry-run-review --enable-core-tools -M "Set up a new React project"
469
+ ```
470
+
471
+ #### How Dry Run Works
472
+
473
+ 1. **Planning Phase**: All tool operations are captured and analyzed instead of executed
474
+ 2. **Risk Assessment**: Each operation is classified as low/medium/high risk
475
+ 3. **Preview Generation**: Shows file diffs, command effects, and safety warnings
476
+ 4. **User Review**: Interactive approval/rejection of individual operations
477
+ 5. **Selective Execution**: Only approved operations are actually executed
478
+
479
+ #### Dry Run Examples
480
+
481
+ ```bash
482
+ # Basic dry run - shows planned operations
483
+ majk-chat chat --dry-run --enable-core-tools -M "Write a hello world script and run it"
484
+
485
+ # Output:
486
+ # 🔍 Dry run mode enabled
487
+ # 📋 Planned 2 operations:
488
+ # 1. [LOW] Write to file: hello.py (67 characters)
489
+ # 2. [MEDIUM] Execute bash command: python hello.py
490
+ #
491
+ # Use --dry-run-review to interactively review and execute operations.
492
+
493
+ # Interactive review mode
494
+ majk-chat chat --dry-run-review --enable-core-tools -M "Update package.json and install dependencies"
495
+
496
+ # Interactive flow:
497
+ # 🔍 Reviewing 2 planned operations
498
+ #
499
+ # 📋 Operation 1/2
500
+ # ──────────────────────────────────────────────────
501
+ # Tool: edit
502
+ # Risk: LOW
503
+ # Category: filesystem
504
+ # Description: Replace first occurrence of "version": "1.0.0" with "version": "1.0.1" in package.json
505
+ #
506
+ # Preview:
507
+ # File: /path/to/package.json
508
+ # - "version": "1.0.0",
509
+ # + "version": "1.0.1",
510
+ #
511
+ # Options:
512
+ # a - Approve this operation
513
+ # r - Reject this operation
514
+ # s - Skip (decide later)
515
+ # p - Show/hide preview
516
+ # d - Show detailed arguments
517
+ # Choice (a/r/s/p/d): a
320
518
  ```
321
519
 
520
+ #### Dry Run Safety Features
521
+
522
+ - **Risk Assessment**: Automatic classification of operations
523
+ - 🟢 **Low Risk**: Simple file reads, basic edits
524
+ - 🟡 **Medium Risk**: Config files, package installs, git operations
525
+ - 🔴 **High Risk**: System files, destructive commands, sudo operations
526
+
527
+ - **Operation Previews**:
528
+ - File operations show diffs and content previews
529
+ - Bash commands show potential effects and warnings
530
+ - Network operations show URLs and request details
531
+
532
+ - **Safety Warnings**: Automatic detection of dangerous patterns
533
+ - `rm -rf` commands
534
+ - `sudo` usage
535
+ - Script downloads (`curl | bash`)
536
+ - Eval/exec operations
537
+
538
+ #### Dry Run Options
539
+
540
+ - `--dry-run` - Plan operations without executing (shows summary)
541
+ - `--dry-run-review` - Plan operations with interactive review and execution
542
+
322
543
  ### Interactive Mode with Core Tools
323
544
 
324
545
  ```bash
325
- # Start interactive session with core tools
546
+ # Start interactive session with core tools using default profile
326
547
  majk-chat interactive --enable-core-tools
327
548
 
549
+ # Start with specific profile for development work
550
+ majk-chat interactive --enable-core-tools --profile development
551
+
328
552
  # Example conversation:
329
553
  User: Find all TypeScript files and show me the first 50 lines of the main entry point
330
554
 
@@ -336,8 +560,8 @@ User: Find all TypeScript files and show me the first 50 lines of the main entry
336
560
  ### Background Process Management
337
561
 
338
562
  ```bash
339
- # Start a long-running task
340
- majk-chat chat -M "Start a development server in the background and monitor its output" --enable-core-tools
563
+ # Start a long-running task with development profile
564
+ majk-chat chat -M "Start a development server in the background and monitor its output" --enable-core-tools --profile development
341
565
 
342
566
  # The LLM can use:
343
567
  # 1. bash --command "npm run dev" --run-in-background
@@ -543,64 +767,164 @@ Each session file contains:
543
767
  - **User explicit consent**: Sessions are only created when explicitly requested
544
768
  - **Local storage only**: All session data stays on your machine
545
769
  - **Easy cleanup**: Sessions can be deleted individually or cleaned up automatically
546
- ## Configuration
770
+ - **Profile inheritance**: Sessions remember the profile used when created and continue using it automatically
547
771
 
548
- ### Configuration File
772
+ ## Profile Configuration (AWS-Style)
549
773
 
550
- Create a configuration file at `~/.majk-chat/config.yaml`:
774
+ The CLI now supports AWS-style profiles for managing multiple sets of credentials. This is the recommended way to manage API keys.
551
775
 
552
- ```yaml
553
- providers:
554
- openai:
555
- apiKey: ${OPENAI_API_KEY}
556
- organizationId: ${OPENAI_ORG_ID}
557
- anthropic:
558
- apiKey: ${ANTHROPIC_API_KEY}
559
- azure-openai:
560
- apiKey: ${AZURE_OPENAI_API_KEY}
561
- endpoint: ${AZURE_OPENAI_ENDPOINT}
562
- deploymentName: ${AZURE_OPENAI_DEPLOYMENT}
563
- bedrock:
564
- region: ${AWS_REGION}
565
- accessKeyId: ${AWS_ACCESS_KEY_ID}
566
- secretAccessKey: ${AWS_SECRET_ACCESS_KEY}
567
-
568
- defaultProvider: openai
776
+ ### Quick Setup
569
777
 
570
- tools:
571
- autoExecute: false
572
- maxSteps: 5
778
+ ```bash
779
+ # Direct configuration (recommended for simple setups)
780
+ majk-chat set-key --openai sk-your-openai-key --profile default
781
+ majk-chat set-key --anthropic sk-ant-your-anthropic-key --profile work
782
+
783
+ # Interactive configuration (recommended for complex setups)
784
+ majk-chat configure-provider openai --profile personal
785
+ majk-chat configure-provider azure-openai --profile production
786
+ ```
787
+
788
+ ### Profile Management
789
+
790
+ ```bash
791
+ # List all configured profiles
792
+ majk-chat list-profiles
793
+ # Output:
794
+ # Configured profiles:
795
+ # default (openai)
796
+ # work (anthropic)
797
+ # production (azure-openai)
798
+
799
+ # Test profile configurations
800
+ majk-chat test-profile work
801
+ majk-chat test-all-profiles
802
+ majk-chat test-provider openai --profile default
803
+
804
+ # Delete a profile
805
+ majk-chat delete-profile old-profile
806
+ ```
807
+
808
+ ### Using Profiles
809
+
810
+ ```bash
811
+ # Use specific profile for chat
812
+ majk-chat chat --profile work -M "Hello from work environment"
813
+
814
+ # Interactive mode with profile
815
+ majk-chat interactive --profile production
816
+
817
+ # Models command with profile
818
+ majk-chat models --profile work
573
819
  ```
574
820
 
575
- You can also use JSON format:
821
+ ### Provider Configuration Commands
822
+
823
+ #### Interactive Configuration
824
+ ```bash
825
+ # OpenAI
826
+ majk-chat configure-provider openai [--profile name] [--skip-validation]
827
+
828
+ # Anthropic
829
+ majk-chat configure-provider anthropic [--profile name] [--skip-validation]
830
+
831
+ # Azure OpenAI (prompts for key, endpoint, deployment)
832
+ majk-chat configure-provider azure-openai [--profile name] [--skip-validation]
833
+
834
+ # AWS Bedrock (prompts for access key, secret key, region)
835
+ majk-chat configure-provider bedrock [--profile name] [--skip-validation]
836
+ ```
837
+
838
+ #### Direct Configuration
839
+ ```bash
840
+ # OpenAI
841
+ majk-chat set-key --openai sk-your-key [--profile name] [--skip-validation]
842
+
843
+ # Anthropic
844
+ majk-chat set-key --anthropic sk-ant-your-key [--profile name] [--skip-validation]
845
+
846
+ # Azure OpenAI (requires all three parameters)
847
+ majk-chat set-key --azure-openai your-key https://your-endpoint.com deployment-name [--profile name]
848
+
849
+ # AWS Bedrock (requires access key and secret key, region optional)
850
+ majk-chat set-key --bedrock access-key secret-key us-east-1 [--profile name]
851
+ ```
852
+
853
+ ### Profile Configuration File
854
+
855
+ Profiles are stored in `~/.magic/chat/config.json`:
576
856
 
577
857
  ```json
578
858
  {
579
- "providers": {
580
- "openai": {
581
- "apiKey": "${OPENAI_API_KEY}"
859
+ "profiles": {
860
+ "default": {
861
+ "providers": {
862
+ "openai": {
863
+ "apiKey": "sk-...",
864
+ "organizationId": "org-..."
865
+ }
866
+ }
867
+ },
868
+ "work": {
869
+ "providers": {
870
+ "anthropic": {
871
+ "apiKey": "sk-ant-..."
872
+ },
873
+ "azure-openai": {
874
+ "apiKey": "...",
875
+ "endpoint": "https://work.openai.azure.com",
876
+ "deploymentName": "gpt-4-work"
877
+ }
878
+ }
879
+ },
880
+ "aws-prod": {
881
+ "providers": {
882
+ "bedrock": {
883
+ "accessKeyId": "AKIA...",
884
+ "secretAccessKey": "...",
885
+ "region": "us-west-2"
886
+ }
887
+ }
582
888
  }
583
- },
584
- "defaultProvider": "openai"
889
+ }
585
890
  }
586
891
  ```
587
892
 
588
- ### Credential Sources
893
+ ### Credential Sources (Resolution Chain)
589
894
 
590
- The CLI looks for credentials in the following order:
895
+ The CLI looks for credentials in the following order (highest to lowest precedence):
591
896
 
592
- 1. **Command-line options** (`--api-key`, `--api-key-file`)
593
- 2. **Environment variables**:
897
+ 1. **Command-line options** (`--openai-api-key`, `--api-key`, etc.)
898
+ 2. **API key files** (`--api-key-file`)
899
+ 3. **Environment variables**:
594
900
  - OpenAI: `OPENAI_API_KEY`, `OPENAI_ORG_ID`
595
901
  - Anthropic: `ANTHROPIC_API_KEY`
596
- - Azure: `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT`
902
+ - Azure: `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_DEPLOYMENT`
597
903
  - AWS: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`
598
- 3. **Standard provider locations**:
904
+ 4. **Standard provider locations**:
599
905
  - `~/.openai/api_key`
600
906
  - `~/.anthropic/api_key`
601
907
  - `~/.config/openai/api_key`
602
908
  - `~/.config/anthropic/api_key`
603
- 4. **Configuration file** (`~/.majk-chat/config.yaml`)
909
+ 5. **Legacy configuration files** (`~/.majk-chat/config.yaml`)
910
+ 6. **Profile-based configuration** (`~/.magic/chat/config.json`) ⭐ **NEW**
911
+
912
+ ### Validation and Testing
913
+
914
+ ```bash
915
+ # Test specific profile
916
+ majk-chat test-profile work
917
+ # Output:
918
+ # Testing profile: work
919
+ # ✓ anthropic (model: claude-3-5-sonnet-20241022)
920
+ # ✗ openai - 401 Incorrect API key
921
+
922
+ # Test all profiles
923
+ majk-chat test-all-profiles
924
+
925
+ # Test specific provider in profile
926
+ majk-chat test-provider openai --profile default
927
+ ```
604
928
 
605
929
  ## Tool Support
606
930
 
@@ -668,15 +992,18 @@ response=$(majk-chat chat -M "Generate a random number between 1 and 100" -j)
668
992
  echo $response | jq '.choices[0].message.content'
669
993
  ```
670
994
 
671
- ### Multiple Providers
995
+ ### Multiple Providers with Profiles
672
996
 
673
997
  ```bash
674
- # Compare responses from different providers
675
- for provider in openai anthropic; do
676
- echo "Provider: $provider"
677
- majk-chat chat -p $provider -M "What is love?"
678
- echo "---"
679
- done
998
+ # Compare responses from different providers using different profiles
999
+ majk-chat chat -p openai --profile personal -M "What is love?"
1000
+ echo "---"
1001
+ majk-chat chat -p anthropic --profile work -M "What is love?"
1002
+ echo "---"
1003
+
1004
+ # Use different profiles for different environments
1005
+ majk-chat chat --profile development -M "Test message"
1006
+ majk-chat chat --profile production -M "Production query"
680
1007
  ```
681
1008
 
682
1009
  ## Environment Variables
@@ -696,14 +1023,37 @@ done
696
1023
  ### No API Key Found
697
1024
 
698
1025
  ```bash
699
- Error: No API key found for provider
1026
+ Error: No valid API credentials found
700
1027
 
701
- Solution:
1028
+ Solution (recommended - profiles):
1029
+ 1. Set up profile: majk-chat set-key --openai sk-... --profile default
1030
+ 2. Use specific profile: majk-chat chat --profile work -M "Hello"
1031
+ 3. Test your setup: majk-chat test-all-profiles
1032
+
1033
+ Traditional solutions:
702
1034
  1. Set environment variable: export OPENAI_API_KEY=sk-...
703
1035
  2. Use --api-key flag: majk-chat chat --api-key sk-...
704
1036
  3. Create config file: majk-chat config --init
705
1037
  ```
706
1038
 
1039
+ ### Profile Issues
1040
+
1041
+ ```bash
1042
+ Error: Profile 'work' not found
1043
+
1044
+ Solution:
1045
+ 1. List profiles: majk-chat list-profiles
1046
+ 2. Create profile: majk-chat set-key --anthropic sk-... --profile work
1047
+ 3. Use existing profile: majk-chat chat --profile default
1048
+
1049
+ Error: Provider validation failed
1050
+
1051
+ Solution:
1052
+ 1. Test configuration: majk-chat test-profile work
1053
+ 2. Reconfigure: majk-chat configure-provider anthropic --profile work
1054
+ 3. Skip validation: majk-chat set-key --anthropic sk-... --skip-validation
1055
+ ```
1056
+
707
1057
  ### Rate Limiting
708
1058
 
709
1059
  ```bash