@codeguide/core 0.0.28 → 0.0.33
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/__tests__/services/codespace/codespace-v2.test.ts +53 -0
- package/__tests__/services/usage/usage-service.test.ts +458 -104
- package/codeguide.ts +3 -0
- package/dist/codeguide.d.ts +2 -1
- package/dist/codeguide.js +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/services/base/base-service.d.ts +21 -0
- package/dist/services/base/base-service.js +114 -0
- package/dist/services/codespace/codespace-service.d.ts +64 -1
- package/dist/services/codespace/codespace-service.js +272 -0
- package/dist/services/codespace/codespace-types.d.ts +213 -12
- package/dist/services/codespace/index.d.ts +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +4 -1
- package/dist/services/projects/project-types.d.ts +66 -32
- package/dist/services/starter-kits/index.d.ts +2 -0
- package/dist/services/starter-kits/index.js +20 -0
- package/dist/services/starter-kits/starter-kits-service.d.ts +13 -0
- package/dist/services/starter-kits/starter-kits-service.js +27 -0
- package/dist/services/starter-kits/starter-kits-types.d.ts +34 -0
- package/dist/services/starter-kits/starter-kits-types.js +2 -0
- package/dist/services/subscriptions/subscription-service.d.ts +11 -1
- package/dist/services/subscriptions/subscription-service.js +14 -0
- package/dist/services/tasks/task-service.d.ts +2 -1
- package/dist/services/tasks/task-service.js +8 -0
- package/dist/services/tasks/task-types.d.ts +26 -7
- package/dist/services/usage/usage-service.d.ts +5 -2
- package/dist/services/usage/usage-service.js +58 -9
- package/dist/services/usage/usage-types.d.ts +157 -34
- package/dist/types.d.ts +18 -2
- package/docs/.vitepress/README.md +51 -0
- package/docs/.vitepress/config.ts +139 -0
- package/docs/.vitepress/theme/custom.css +80 -0
- package/docs/.vitepress/theme/index.ts +13 -0
- package/docs/.vitepress/tsconfig.json +19 -0
- package/docs/QUICKSTART.md +77 -0
- package/docs/README.md +134 -0
- package/docs/README_SETUP.md +46 -0
- package/docs/authentication.md +351 -0
- package/docs/codeguide-client.md +350 -0
- package/docs/codespace-models.md +1004 -0
- package/docs/codespace-service.md +444 -0
- package/docs/index.md +135 -0
- package/docs/package.json +14 -0
- package/docs/projects-service.md +688 -0
- package/docs/security-keys-service.md +773 -0
- package/docs/starter-kits-service.md +249 -0
- package/docs/task-service.md +955 -0
- package/docs/testsprite_tests/TC001_Homepage_Load_and_Hero_Section_Display.py +70 -0
- package/docs/testsprite_tests/TC002_Sidebar_Navigation_ExpandCollapse_Functionality.py +73 -0
- package/docs/testsprite_tests/TC003_Full_Text_Local_Search_with_Keyboard_Shortcut.py +90 -0
- package/docs/testsprite_tests/TC004_Dark_Mode_Toggle_and_Persistence.py +73 -0
- package/docs/testsprite_tests/TC005_Mobile_Responsiveness_and_Touch_Navigation.py +113 -0
- package/docs/testsprite_tests/TC006_GitHub_Integration_Edit_this_page_Links.py +73 -0
- package/docs/testsprite_tests/TC007_Syntax_Highlighting_and_Code_Copy_Functionality.py +73 -0
- package/docs/testsprite_tests/TC008_Auto_Generated_Table_of_Contents_Accuracy.py +73 -0
- package/docs/testsprite_tests/TC009_SEO_and_Content_Discoverability_Verification.py +73 -0
- package/docs/testsprite_tests/TC010_Accessibility_Compliance_WCAG_AA.py +73 -0
- package/docs/testsprite_tests/TC011_Local_Development_Workflow_Build_and_Hot_Reload.py +74 -0
- package/docs/testsprite_tests/TC012_Performance_Metrics_Compliance.py +73 -0
- package/docs/testsprite_tests/standard_prd.json +122 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.html +2508 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.md +273 -0
- package/docs/testsprite_tests/testsprite_frontend_test_plan.json +390 -0
- package/docs/usage-service.md +291 -1
- package/index.ts +11 -3
- package/package.json +17 -2
- package/plans/CODESPACE_LOGS_STREAMING_GUIDE.md +320 -0
- package/plans/CODESPACE_TASK_LOGS_API_COMPLETE_GUIDE.md +821 -0
- package/services/base/base-service.ts +130 -0
- package/services/codespace/codespace-service.ts +359 -0
- package/services/codespace/codespace-types.ts +295 -13
- package/services/codespace/index.ts +21 -1
- package/services/index.ts +2 -0
- package/services/projects/README.md +107 -34
- package/services/projects/project-types.ts +69 -32
- package/services/starter-kits/index.ts +2 -0
- package/services/starter-kits/starter-kits-service.ts +33 -0
- package/services/starter-kits/starter-kits-types.ts +38 -0
- package/services/subscriptions/subscription-service.ts +23 -5
- package/services/tasks/task-service.ts +10 -0
- package/services/tasks/task-types.ts +29 -7
- package/services/usage/usage-service.ts +59 -10
- package/services/usage/usage-types.ts +186 -36
- package/types.ts +22 -2
|
@@ -71,6 +71,14 @@ The Codespace Service provides the following methods:
|
|
|
71
71
|
| `getCodespaceTasksByProject()` | Get tasks for a project | `GET /codespace/tasks/project/{id}` |
|
|
72
72
|
| `getCodespaceTaskDetailed()` | Get detailed task info | `GET /codespace/task/{id}/detailed` |
|
|
73
73
|
| `getProjectTasksByCodespace()` | Get project tasks by codespace | `GET /project-tasks/by-codespace/{id}` |
|
|
74
|
+
| `getRelatedCodespaceTasks()` | Get related tasks by parent ID | `GET /codespace/tasks/related/{id}` |
|
|
75
|
+
| `generateQuestionnaire()` | Generate questionnaire for task | `POST /codespace/generate-questionnaire` |
|
|
76
|
+
| `createCodespaceTask()` | Create codespace task (legacy) | `POST /codespace/create-task` |
|
|
77
|
+
| `getCodespaceModels()` | Get all codespace models | `GET /api/codespace-models/models` |
|
|
78
|
+
| `getCodespaceModel()` | Get specific codespace model | `GET /api/codespace-models/models/{id}` |
|
|
79
|
+
| `getLLMModelProviders()` | Get all LLM model providers | `GET /api/codespace-models/providers` |
|
|
80
|
+
| `getLLMModelProvider()` | Get specific LLM model provider | `GET /api/codespace-models/providers/{id}` |
|
|
81
|
+
| `getModelsByProvider()` | Get models by provider | `GET /api/codespace-models/providers/{id}/models` |
|
|
74
82
|
|
|
75
83
|
## Detailed Method Documentation
|
|
76
84
|
|
|
@@ -416,6 +424,420 @@ response.data.forEach(projectTask => {
|
|
|
416
424
|
})
|
|
417
425
|
```
|
|
418
426
|
|
|
427
|
+
### 8. getRelatedCodespaceTasks()
|
|
428
|
+
|
|
429
|
+
Retrieves codespace tasks that are related to a parent task ID, including model information and attachments.
|
|
430
|
+
|
|
431
|
+
#### Signature
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
async getRelatedCodespaceTasks(params: GetRelatedCodespaceTasksRequest): Promise<CodespaceTasksListResponse>
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
#### Parameters
|
|
438
|
+
|
|
439
|
+
```typescript
|
|
440
|
+
interface GetRelatedCodespaceTasksRequest {
|
|
441
|
+
parent_id: string // Required: The parent codespace task ID
|
|
442
|
+
status?: 'completed' | 'failed' | 'in_progress' | 'created' | 'cancelled'
|
|
443
|
+
limit?: number // Optional (default: 50)
|
|
444
|
+
offset?: number // Optional (default: 0)
|
|
445
|
+
sort_by?: string // Optional (default: "created_at")
|
|
446
|
+
sort_order?: 'asc' | 'desc' // Optional (default: "desc")
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### Response
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
interface CodespaceTasksListResponse {
|
|
454
|
+
status: string
|
|
455
|
+
data: CodespaceTaskInDBWithModel[]
|
|
456
|
+
total_count: number
|
|
457
|
+
message: string
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
interface CodespaceTaskInDBWithModel {
|
|
461
|
+
id: string
|
|
462
|
+
codespace_task_id: string
|
|
463
|
+
project_id: string
|
|
464
|
+
user_id: string
|
|
465
|
+
status: string
|
|
466
|
+
progress: string
|
|
467
|
+
created_at: string
|
|
468
|
+
updated_at?: string
|
|
469
|
+
completed_at?: string
|
|
470
|
+
title: string
|
|
471
|
+
task_description: string
|
|
472
|
+
metadata?: any
|
|
473
|
+
model_id?: string
|
|
474
|
+
execution_mode?: string
|
|
475
|
+
context_data?: any
|
|
476
|
+
model?: CodespaceModelWithProvider // Model information
|
|
477
|
+
task_models?: CodespaceTaskModelInDB[] // Associated task models
|
|
478
|
+
attachments?: AttachmentResponse[] // Associated attachments
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
interface CodespaceModelWithProvider {
|
|
482
|
+
id: string
|
|
483
|
+
created_at: string
|
|
484
|
+
key?: string
|
|
485
|
+
name?: string
|
|
486
|
+
provider_id?: string
|
|
487
|
+
base_url?: string
|
|
488
|
+
completion_base_url?: string
|
|
489
|
+
execution_mode?: 'opencode' | 'claude-code' | 'docs-only' | 'implementation'
|
|
490
|
+
logo_src?: string
|
|
491
|
+
provider?: LLMModelProviderInDB
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
interface CodespaceTaskModelInDB {
|
|
495
|
+
id: string
|
|
496
|
+
created_at: string
|
|
497
|
+
codespace_task_id: string
|
|
498
|
+
model_id: string
|
|
499
|
+
model_name?: string
|
|
500
|
+
model_key?: string
|
|
501
|
+
provider_id?: string
|
|
502
|
+
provider_name?: string
|
|
503
|
+
execution_mode?: string
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
interface AttachmentResponse {
|
|
507
|
+
id: string
|
|
508
|
+
filename: string
|
|
509
|
+
file_data: string
|
|
510
|
+
mime_type: string
|
|
511
|
+
file_size: number
|
|
512
|
+
description?: string
|
|
513
|
+
created_at: string
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
#### Example
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
// Get all related tasks for a parent task
|
|
521
|
+
const response = await codespace.getRelatedCodespaceTasks({
|
|
522
|
+
parent_id: 'parent_task_uuid_here',
|
|
523
|
+
status: 'in_progress',
|
|
524
|
+
limit: 10,
|
|
525
|
+
sort_by: 'created_at',
|
|
526
|
+
sort_order: 'desc'
|
|
527
|
+
})
|
|
528
|
+
|
|
529
|
+
console.log(`Found ${response.total_count} related tasks`)
|
|
530
|
+
response.data.forEach(task => {
|
|
531
|
+
console.log(`- ${task.title} (${task.status})`)
|
|
532
|
+
console.log(` Model: ${task.model?.name || 'Default'}`)
|
|
533
|
+
console.log(` Attachments: ${task.attachments?.length || 0}`)
|
|
534
|
+
|
|
535
|
+
if (task.task_models && task.task_models.length > 0) {
|
|
536
|
+
console.log(` Task Models: ${task.task_models.map(tm => tm.model_name).join(', ')}`)
|
|
537
|
+
}
|
|
538
|
+
})
|
|
539
|
+
|
|
540
|
+
// Get completed related tasks with pagination
|
|
541
|
+
const completedTasks = await codespace.getRelatedCodespaceTasks({
|
|
542
|
+
parent_id: 'parent_task_uuid_here',
|
|
543
|
+
status: 'completed',
|
|
544
|
+
limit: 5,
|
|
545
|
+
offset: 0
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
console.log(`Completed related tasks: ${completedTasks.data.length} of ${completedTasks.total_count}`)
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### 9. generateQuestionnaire()
|
|
552
|
+
|
|
553
|
+
Generates a questionnaire for a task description to gather additional context.
|
|
554
|
+
|
|
555
|
+
#### Signature
|
|
556
|
+
|
|
557
|
+
```typescript
|
|
558
|
+
async generateQuestionnaire(request: CodespaceQuestionnaireRequest): Promise<CodespaceQuestionnaireResponse>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
#### Parameters
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
interface CodespaceQuestionnaireRequest {
|
|
565
|
+
task_description: string // Required: Task description
|
|
566
|
+
project_context?: string // Optional: Project context
|
|
567
|
+
repository_info?: { // Optional: Repository information
|
|
568
|
+
name?: string
|
|
569
|
+
description?: string
|
|
570
|
+
}
|
|
571
|
+
attachments?: Attachment[] // Optional: File attachments
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
interface Attachment {
|
|
575
|
+
filename: string
|
|
576
|
+
file_data: string // Base64 encoded file data
|
|
577
|
+
mime_type: string
|
|
578
|
+
file_size: number
|
|
579
|
+
description?: string
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
#### Response
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
interface CodespaceQuestionnaireResponse {
|
|
587
|
+
success: boolean
|
|
588
|
+
questions: string[] // Array of generated questions
|
|
589
|
+
message: string
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### Example
|
|
594
|
+
|
|
595
|
+
```typescript
|
|
596
|
+
const response = await codespace.generateQuestionnaire({
|
|
597
|
+
task_description: 'Implement user authentication system',
|
|
598
|
+
project_context: 'React application with Node.js backend',
|
|
599
|
+
repository_info: {
|
|
600
|
+
name: 'my-app',
|
|
601
|
+
description: 'Full-stack web application',
|
|
602
|
+
},
|
|
603
|
+
})
|
|
604
|
+
|
|
605
|
+
console.log('Generated questions:')
|
|
606
|
+
response.questions.forEach((question, index) => {
|
|
607
|
+
console.log(`${index + 1}. ${question}`)
|
|
608
|
+
})
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### 9. createCodespaceTask()
|
|
612
|
+
|
|
613
|
+
Creates a codespace task using the legacy endpoint (for backward compatibility).
|
|
614
|
+
|
|
615
|
+
#### Signature
|
|
616
|
+
|
|
617
|
+
```typescript
|
|
618
|
+
async createCodespaceTask(request: CreateCodespaceTaskRequest): Promise<CreateCodespaceTaskResponse>
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
#### Parameters
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
interface CreateCodespaceTaskRequest {
|
|
625
|
+
title: string // Required: Task title
|
|
626
|
+
description: string // Required: Task description
|
|
627
|
+
conversation_id?: string // Optional: Conversation ID
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Response
|
|
632
|
+
|
|
633
|
+
```typescript
|
|
634
|
+
interface CreateCodespaceTaskResponse {
|
|
635
|
+
success: boolean
|
|
636
|
+
task_id: string
|
|
637
|
+
message: string
|
|
638
|
+
}
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
#### Example
|
|
642
|
+
|
|
643
|
+
```typescript
|
|
644
|
+
const response = await codespace.createCodespaceTask({
|
|
645
|
+
title: 'User Authentication',
|
|
646
|
+
description: 'Implement login and registration',
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
console.log(`Task created: ${response.task_id}`)
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
## Codespace Models Methods
|
|
653
|
+
|
|
654
|
+
The Codespace Service also provides methods for managing LLM models and providers used in codespace tasks.
|
|
655
|
+
|
|
656
|
+
### 10. getCodespaceModels()
|
|
657
|
+
|
|
658
|
+
Retrieves all available codespace models with optional filtering.
|
|
659
|
+
|
|
660
|
+
#### Signature
|
|
661
|
+
|
|
662
|
+
```typescript
|
|
663
|
+
async getCodespaceModels(query?: GetCodespaceModelsQuery): Promise<GetCodespaceModelsResponse>
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
#### Parameters
|
|
667
|
+
|
|
668
|
+
```typescript
|
|
669
|
+
interface GetCodespaceModelsQuery {
|
|
670
|
+
provider_id?: string // Optional: Filter by provider ID
|
|
671
|
+
execution_mode?: string // Optional: Filter by execution mode
|
|
672
|
+
}
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
#### Response
|
|
676
|
+
|
|
677
|
+
```typescript
|
|
678
|
+
interface GetCodespaceModelsResponse extends Array<CodespaceModelWithProvider> {}
|
|
679
|
+
|
|
680
|
+
interface CodespaceModelWithProvider {
|
|
681
|
+
id: string
|
|
682
|
+
created_at: string
|
|
683
|
+
key?: string
|
|
684
|
+
name?: string
|
|
685
|
+
provider_id?: string
|
|
686
|
+
base_url?: string
|
|
687
|
+
completion_base_url?: string
|
|
688
|
+
execution_mode?: 'opencode' | 'claude-code' | 'docs-only' | 'implementation'
|
|
689
|
+
logo_src?: string
|
|
690
|
+
provider?: LLMModelProviderInDB
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
interface LLMModelProviderInDB {
|
|
694
|
+
id: string
|
|
695
|
+
created_at: string
|
|
696
|
+
name?: string
|
|
697
|
+
key?: string
|
|
698
|
+
logo_src?: string
|
|
699
|
+
}
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
#### Example
|
|
703
|
+
|
|
704
|
+
```typescript
|
|
705
|
+
// Get all models
|
|
706
|
+
const allModels = await codespace.getCodespaceModels()
|
|
707
|
+
|
|
708
|
+
// Filter by provider
|
|
709
|
+
const openaiModels = await codespace.getCodespaceModels({
|
|
710
|
+
provider_id: 'provider_openai_id',
|
|
711
|
+
})
|
|
712
|
+
|
|
713
|
+
// Filter by execution mode
|
|
714
|
+
const implementationModels = await codespace.getCodespaceModels({
|
|
715
|
+
execution_mode: 'implementation',
|
|
716
|
+
})
|
|
717
|
+
|
|
718
|
+
console.log(`Found ${allModels.length} total models`)
|
|
719
|
+
allModels.forEach(model => {
|
|
720
|
+
console.log(`- ${model.name} (${model.provider?.name})`)
|
|
721
|
+
})
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
### 11. getCodespaceModel()
|
|
725
|
+
|
|
726
|
+
Retrieves a specific codespace model by ID.
|
|
727
|
+
|
|
728
|
+
#### Signature
|
|
729
|
+
|
|
730
|
+
```typescript
|
|
731
|
+
async getCodespaceModel(modelId: string): Promise<GetCodespaceModelResponse>
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
#### Parameters
|
|
735
|
+
|
|
736
|
+
- `modelId` (string, required): The UUID of the model
|
|
737
|
+
|
|
738
|
+
#### Returns
|
|
739
|
+
|
|
740
|
+
- `Promise<GetCodespaceModelResponse>`: Model object with provider information
|
|
741
|
+
|
|
742
|
+
#### Example
|
|
743
|
+
|
|
744
|
+
```typescript
|
|
745
|
+
const model = await codespace.getCodespaceModel('model_uuid_here')
|
|
746
|
+
|
|
747
|
+
console.log(`Model: ${model.name}`)
|
|
748
|
+
console.log(`Provider: ${model.provider?.name}`)
|
|
749
|
+
console.log(`Execution Mode: ${model.execution_mode}`)
|
|
750
|
+
console.log(`Base URL: ${model.base_url}`)
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### 12. getLLMModelProviders()
|
|
754
|
+
|
|
755
|
+
Retrieves all available LLM model providers.
|
|
756
|
+
|
|
757
|
+
#### Signature
|
|
758
|
+
|
|
759
|
+
```typescript
|
|
760
|
+
async getLLMModelProviders(): Promise<GetLLMModelProvidersResponse>
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
#### Returns
|
|
764
|
+
|
|
765
|
+
```typescript
|
|
766
|
+
interface GetLLMModelProvidersResponse extends Array<LLMModelProviderInDB> {}
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
#### Example
|
|
770
|
+
|
|
771
|
+
```typescript
|
|
772
|
+
const providers = await codespace.getLLMModelProviders()
|
|
773
|
+
|
|
774
|
+
console.log(`Found ${providers.length} providers:`)
|
|
775
|
+
providers.forEach(provider => {
|
|
776
|
+
console.log(`- ${provider.name} (${provider.key})`)
|
|
777
|
+
})
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### 13. getLLMModelProvider()
|
|
781
|
+
|
|
782
|
+
Retrieves a specific LLM model provider by ID.
|
|
783
|
+
|
|
784
|
+
#### Signature
|
|
785
|
+
|
|
786
|
+
```typescript
|
|
787
|
+
async getLLMModelProvider(providerId: string): Promise<GetLLMModelProviderResponse>
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
#### Parameters
|
|
791
|
+
|
|
792
|
+
- `providerId` (string, required): The UUID of the provider
|
|
793
|
+
|
|
794
|
+
#### Returns
|
|
795
|
+
|
|
796
|
+
- `Promise<GetLLMModelProviderResponse>`: Provider object
|
|
797
|
+
|
|
798
|
+
#### Example
|
|
799
|
+
|
|
800
|
+
```typescript
|
|
801
|
+
const provider = await codespace.getLLMModelProvider('provider_uuid_here')
|
|
802
|
+
|
|
803
|
+
console.log(`Provider: ${provider.name}`)
|
|
804
|
+
console.log(`Key: ${provider.key}`)
|
|
805
|
+
if (provider.logo_src) {
|
|
806
|
+
console.log(`Logo: ${provider.logo_src}`)
|
|
807
|
+
}
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
### 14. getModelsByProvider()
|
|
811
|
+
|
|
812
|
+
Retrieves all models for a specific provider.
|
|
813
|
+
|
|
814
|
+
#### Signature
|
|
815
|
+
|
|
816
|
+
```typescript
|
|
817
|
+
async getModelsByProvider(providerId: string): Promise<GetModelsByProviderResponse>
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
#### Parameters
|
|
821
|
+
|
|
822
|
+
- `providerId` (string, required): The UUID of the provider
|
|
823
|
+
|
|
824
|
+
#### Returns
|
|
825
|
+
|
|
826
|
+
```typescript
|
|
827
|
+
interface GetModelsByProviderResponse extends Array<CodespaceModelInDB> {}
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
#### Example
|
|
831
|
+
|
|
832
|
+
```typescript
|
|
833
|
+
const openaiModels = await codespace.getModelsByProvider('provider_openai_id')
|
|
834
|
+
|
|
835
|
+
console.log(`Found ${openaiModels.length} OpenAI models:`)
|
|
836
|
+
openaiModels.forEach(model => {
|
|
837
|
+
console.log(`- ${model.name} (${model.execution_mode})`)
|
|
838
|
+
})
|
|
839
|
+
```
|
|
840
|
+
|
|
419
841
|
## Error Handling
|
|
420
842
|
|
|
421
843
|
All methods throw errors for various failure conditions. Common error types include:
|
|
@@ -618,9 +1040,12 @@ The package exports the following types for TypeScript users:
|
|
|
618
1040
|
import type {
|
|
619
1041
|
CreateCodespaceTaskRequest,
|
|
620
1042
|
CreateCodespaceTaskResponse,
|
|
1043
|
+
CreateCodespaceTaskRequestV2,
|
|
1044
|
+
CreateCodespaceTaskResponseV2,
|
|
621
1045
|
CreateBackgroundCodespaceTaskRequest,
|
|
622
1046
|
CreateBackgroundCodespaceTaskResponse,
|
|
623
1047
|
ModelApiKey,
|
|
1048
|
+
Attachment,
|
|
624
1049
|
GetCodespaceTaskResponse,
|
|
625
1050
|
CodespaceTaskData,
|
|
626
1051
|
TechnicalDocument,
|
|
@@ -628,7 +1053,26 @@ import type {
|
|
|
628
1053
|
GetCodespaceTasksByProjectRequest,
|
|
629
1054
|
GetCodespaceTasksByProjectResponse,
|
|
630
1055
|
CodespaceTaskDetailedResponse,
|
|
1056
|
+
CodespaceQuestionnaireRequest,
|
|
1057
|
+
CodespaceQuestionnaireResponse,
|
|
1058
|
+
GetRelatedCodespaceTasksRequest,
|
|
1059
|
+
CodespaceTasksListResponse,
|
|
1060
|
+
CodespaceTaskInDBWithModel,
|
|
1061
|
+
AttachmentResponse,
|
|
1062
|
+
CodespaceTaskModelInDB,
|
|
1063
|
+
GetCodespaceModelsQuery,
|
|
1064
|
+
GetCodespaceModelsResponse,
|
|
1065
|
+
GetCodespaceModelResponse,
|
|
1066
|
+
GetLLMModelProvidersResponse,
|
|
1067
|
+
GetLLMModelProviderResponse,
|
|
1068
|
+
GetModelsByProviderResponse,
|
|
631
1069
|
} from '@codeguide/core'
|
|
632
1070
|
```
|
|
633
1071
|
|
|
1072
|
+
## Related Documentation
|
|
1073
|
+
|
|
1074
|
+
- [Codespace Models](./codespace-models.md) - Detailed documentation on codespace models and providers
|
|
1075
|
+
- [Projects Service](./projects-service.md) - Project management
|
|
1076
|
+
- [CodeGuide Client](./codeguide-client.md) - Client initialization
|
|
1077
|
+
|
|
634
1078
|
For more information, visit the [API documentation](https://docs.codeguide.dev) or check the [GitHub repository](https://github.com/codeguide/cli).
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
|
|
4
|
+
hero:
|
|
5
|
+
name: '@codeguide/core'
|
|
6
|
+
text: 'TypeScript SDK'
|
|
7
|
+
tagline: Complete TypeScript SDK for integrating CodeGuide functionality into your applications
|
|
8
|
+
actions:
|
|
9
|
+
- theme: brand
|
|
10
|
+
text: Get Started
|
|
11
|
+
link: /codeguide-client
|
|
12
|
+
- theme: alt
|
|
13
|
+
text: View on GitHub
|
|
14
|
+
link: https://github.com/CodeGuide-dev/codeguide
|
|
15
|
+
|
|
16
|
+
features:
|
|
17
|
+
- title: 🔑 Multiple Authentication Methods
|
|
18
|
+
details: Database API keys, legacy keys, and JWT tokens with automatic fallback
|
|
19
|
+
- title: 📝 Project Management
|
|
20
|
+
details: Create, update, and manage projects programmatically with full CRUD operations
|
|
21
|
+
- title: 🤖 Codespace Tasks
|
|
22
|
+
details: Create and manage AI-powered coding tasks with support for multiple execution modes
|
|
23
|
+
- title: 🎯 Model Management
|
|
24
|
+
details: Query and manage LLM models and providers for your codespace tasks
|
|
25
|
+
- title: 🔐 Security Keys
|
|
26
|
+
details: Securely manage provider API keys and GitHub tokens with encryption
|
|
27
|
+
- title: 🛡️ TypeScript Support
|
|
28
|
+
details: Full type safety and IntelliSense support for all API methods
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @codeguide/core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Basic Usage
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { CodeGuide } from '@codeguide/core'
|
|
43
|
+
|
|
44
|
+
// Initialize the CodeGuide client
|
|
45
|
+
const codeguide = new CodeGuide({
|
|
46
|
+
baseUrl: 'https://api.codeguide.ai',
|
|
47
|
+
databaseApiKey: 'sk_your_database_api_key', // Recommended
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Access services
|
|
51
|
+
const projects = await codeguide.projects.getAllProjects()
|
|
52
|
+
const tasks = await codeguide.codespace.getCodespaceTasksByProject({
|
|
53
|
+
project_id: 'your_project_id',
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Documentation Structure
|
|
58
|
+
|
|
59
|
+
### Core Components
|
|
60
|
+
|
|
61
|
+
- **[CodeGuide Client](./codeguide-client.md)** - Main client class and initialization
|
|
62
|
+
- **[Authentication](./authentication.md)** - Authentication methods and configuration
|
|
63
|
+
|
|
64
|
+
### Services
|
|
65
|
+
|
|
66
|
+
- **[Projects Service](./projects-service.md)** - Project management and repository connections
|
|
67
|
+
- **[Codespace Service](./codespace-service.md)** - AI-powered coding tasks and workflows
|
|
68
|
+
- **[Codespace Models](./codespace-models.md)** - LLM model providers and model management
|
|
69
|
+
- **[Security Keys Service](./security-keys-service.md)** - Provider API keys and GitHub token management
|
|
70
|
+
- **[Usage Service](./usage-service.md)** - Usage tracking and authorization
|
|
71
|
+
- **[Starter Kits Service](./starter-kits-service.md)** - Retrieve starter kits for bootstrapping projects
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- 🔑 **Multiple Authentication Methods** - Database API keys, legacy keys, and JWT tokens
|
|
76
|
+
- 📝 **Project Management** - Create, update, and manage projects programmatically
|
|
77
|
+
- 🤖 **Codespace Tasks** - Create and manage AI-powered coding tasks
|
|
78
|
+
- 🎯 **Model Management** - Query and manage LLM models and providers
|
|
79
|
+
- 🔐 **Security Keys** - Securely manage provider API keys and GitHub tokens
|
|
80
|
+
- 📊 **Usage Tracking** - Monitor API usage and credits
|
|
81
|
+
- 🛡️ **TypeScript Support** - Full type safety and IntelliSense
|
|
82
|
+
|
|
83
|
+
## Getting Started
|
|
84
|
+
|
|
85
|
+
1. **Install the package**: `npm install @codeguide/core`
|
|
86
|
+
2. **Get your API key**: Sign up at [codeguide.ai](https://codeguide.ai) to get your API key
|
|
87
|
+
3. **Initialize the client**: See [CodeGuide Client](./codeguide-client.md) for setup instructions
|
|
88
|
+
4. **Authenticate**: See [Authentication](./authentication.md) for authentication options
|
|
89
|
+
5. **Start building**: Explore the service documentation to learn about available features
|
|
90
|
+
|
|
91
|
+
## Common Use Cases
|
|
92
|
+
|
|
93
|
+
### Creating a Project
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
const project = await codeguide.projects.createProject({
|
|
97
|
+
title: 'My New Project',
|
|
98
|
+
description: 'Project description here',
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Creating a Codespace Task
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const task = await codeguide.codespace.createCodespaceTaskV2({
|
|
106
|
+
project_id: project.id,
|
|
107
|
+
task_description: 'Implement user authentication',
|
|
108
|
+
execution_mode: 'implementation',
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Managing Security Keys
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Store a provider API key
|
|
116
|
+
await codeguide.securityKeys.createProviderAPIKey({
|
|
117
|
+
provider_key: 'openai',
|
|
118
|
+
api_key: 'sk-your-openai-key',
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// Store a GitHub token
|
|
122
|
+
await codeguide.securityKeys.createGitHubToken({
|
|
123
|
+
github_token: 'ghp_your_github_token',
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Support
|
|
128
|
+
|
|
129
|
+
- **GitHub**: [CodeGuide Repository](https://github.com/CodeGuide-dev/codeguide)
|
|
130
|
+
- **Issues**: [GitHub Issues](https://github.com/CodeGuide-dev/codeguide/issues)
|
|
131
|
+
- **Documentation**: This documentation site
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codeguide/core-docs",
|
|
3
|
+
"version": "0.0.28",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vitepress dev .",
|
|
7
|
+
"build": "vitepress build .",
|
|
8
|
+
"preview": "vitepress preview ."
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"vitepress": "^1.0.0",
|
|
12
|
+
"vue": "^3.3.0"
|
|
13
|
+
}
|
|
14
|
+
}
|