@codeguide/core 0.0.27 → 0.0.29
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 +50 -41
- package/__tests__/services/codespace/codespace-v2.test.ts +29 -18
- package/__tests__/services/usage/usage-service.test.ts +597 -85
- package/codeguide.ts +6 -0
- package/dist/codeguide.d.ts +3 -1
- package/dist/codeguide.js +2 -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 +55 -1
- package/dist/services/codespace/codespace-service.js +260 -5
- package/dist/services/codespace/codespace-types.d.ts +193 -13
- package/dist/services/codespace/index.d.ts +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +7 -1
- package/dist/services/projects/project-types.d.ts +66 -32
- package/dist/services/repository-analysis/repository-types.d.ts +1 -0
- 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/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 +207 -34
- package/dist/services/users/index.d.ts +2 -0
- package/dist/services/users/index.js +20 -0
- package/dist/services/users/user-service.d.ts +12 -0
- package/dist/services/users/user-service.js +17 -0
- package/dist/services/users/user-types.d.ts +55 -0
- package/dist/services/users/user-types.js +2 -0
- 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 +558 -81
- 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 +616 -0
- package/index.ts +11 -3
- package/package.json +16 -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 +347 -8
- package/services/codespace/codespace-types.ts +263 -14
- package/services/codespace/index.ts +16 -1
- package/services/index.ts +4 -0
- package/services/projects/README.md +107 -34
- package/services/projects/project-types.ts +69 -32
- package/services/repository-analysis/repository-types.ts +1 -0
- 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/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 +239 -34
- package/services/users/index.ts +2 -0
- package/services/users/user-service.ts +15 -0
- package/services/users/user-types.ts +59 -0
|
@@ -31,7 +31,7 @@ const codeguide = new CodeGuide({
|
|
|
31
31
|
// Alternative authentication methods:
|
|
32
32
|
// apiKey: 'your_legacy_api_key',
|
|
33
33
|
// jwtToken: 'your_clerk_jwt_token',
|
|
34
|
-
timeout: 30000
|
|
34
|
+
timeout: 30000,
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
// Access the codespace service
|
|
@@ -62,15 +62,23 @@ The service will automatically use the highest priority authentication method av
|
|
|
62
62
|
|
|
63
63
|
The Codespace Service provides the following methods:
|
|
64
64
|
|
|
65
|
-
| Method
|
|
66
|
-
|
|
67
|
-
| `generateTaskTitle()`
|
|
68
|
-
| `createCodespaceTaskV2()`
|
|
69
|
-
| `createBackgroundCodespaceTask()` | Create task in background
|
|
70
|
-
| `getCodespaceTask()`
|
|
71
|
-
| `getCodespaceTasksByProject()`
|
|
72
|
-
| `getCodespaceTaskDetailed()`
|
|
73
|
-
| `getProjectTasksByCodespace()`
|
|
65
|
+
| Method | Description | Endpoint |
|
|
66
|
+
| --------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
67
|
+
| `generateTaskTitle()` | Generate a title from task description | `POST /codespace/generate-task-title` |
|
|
68
|
+
| `createCodespaceTaskV2()` | Create a new codespace task | `POST /codespace/task` |
|
|
69
|
+
| `createBackgroundCodespaceTask()` | Create task in background | `POST /codespace/task/background` |
|
|
70
|
+
| `getCodespaceTask()` | Get task by ID | `GET /codespace/task/{id}` |
|
|
71
|
+
| `getCodespaceTasksByProject()` | Get tasks for a project | `GET /codespace/tasks/project/{id}` |
|
|
72
|
+
| `getCodespaceTaskDetailed()` | Get detailed task info | `GET /codespace/task/{id}/detailed` |
|
|
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
|
|
|
@@ -79,14 +87,17 @@ The Codespace Service provides the following methods:
|
|
|
79
87
|
Generates a concise title from a detailed task description using AI or fallback logic.
|
|
80
88
|
|
|
81
89
|
#### Signature
|
|
90
|
+
|
|
82
91
|
```typescript
|
|
83
92
|
async generateTaskTitle(request: GenerateTaskTitleRequest): Promise<GenerateTaskTitleResponse>
|
|
84
93
|
```
|
|
85
94
|
|
|
86
95
|
#### Parameters
|
|
96
|
+
|
|
87
97
|
- `request.task_description` (string, required): The full task description to generate title from
|
|
88
98
|
|
|
89
99
|
#### Response
|
|
100
|
+
|
|
90
101
|
```typescript
|
|
91
102
|
interface GenerateTaskTitleResponse {
|
|
92
103
|
success: boolean
|
|
@@ -97,9 +108,11 @@ interface GenerateTaskTitleResponse {
|
|
|
97
108
|
```
|
|
98
109
|
|
|
99
110
|
#### Example
|
|
111
|
+
|
|
100
112
|
```typescript
|
|
101
113
|
const response = await codespace.generateTaskTitle({
|
|
102
|
-
task_description:
|
|
114
|
+
task_description:
|
|
115
|
+
'Create a user authentication system with login, registration, and password reset functionality using JWT tokens and bcrypt for password hashing',
|
|
103
116
|
})
|
|
104
117
|
|
|
105
118
|
console.log(response.title) // "User Authentication System"
|
|
@@ -111,27 +124,29 @@ console.log(response.fallback_used) // false if AI generated, true if fallback u
|
|
|
111
124
|
Creates a new codespace task with complete workflow including PRD generation, task creation, and Claude Code integration.
|
|
112
125
|
|
|
113
126
|
#### Signature
|
|
127
|
+
|
|
114
128
|
```typescript
|
|
115
129
|
async createCodespaceTaskV2(request: CreateCodespaceTaskRequestV2): Promise<CreateCodespaceTaskResponseV2>
|
|
116
130
|
```
|
|
117
131
|
|
|
118
132
|
#### Parameters
|
|
133
|
+
|
|
119
134
|
```typescript
|
|
120
135
|
interface CreateCodespaceTaskRequestV2 {
|
|
121
|
-
project_id: string
|
|
122
|
-
task_description: string
|
|
123
|
-
project_repository_id?: string
|
|
124
|
-
title?: string
|
|
125
|
-
branch?: string
|
|
126
|
-
working_branch?: string
|
|
127
|
-
base_branch?: string
|
|
128
|
-
docs_url?: string
|
|
129
|
-
model_api_keys?: ModelApiKey[]
|
|
130
|
-
github_token?: string
|
|
131
|
-
codespace_task_id?: string
|
|
132
|
-
execution_mode?: 'implementation' | 'docs-only'
|
|
133
|
-
model_name?: string
|
|
134
|
-
starter_kit_repo?: string
|
|
136
|
+
project_id: string // Required
|
|
137
|
+
task_description: string // Required
|
|
138
|
+
project_repository_id?: string // Optional
|
|
139
|
+
title?: string // Optional
|
|
140
|
+
branch?: string // Optional
|
|
141
|
+
working_branch?: string // Optional
|
|
142
|
+
base_branch?: string // Optional (default: "main")
|
|
143
|
+
docs_url?: string // Optional
|
|
144
|
+
model_api_keys?: ModelApiKey[] // Optional
|
|
145
|
+
github_token?: string // Optional
|
|
146
|
+
codespace_task_id?: string // Optional (for continuation)
|
|
147
|
+
execution_mode?: 'implementation' | 'docs-only' | 'direct' // Optional (default: "implementation")
|
|
148
|
+
model_name?: string // Optional
|
|
149
|
+
starter_kit_repo?: string // Optional
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
interface ModelApiKey {
|
|
@@ -141,6 +156,7 @@ interface ModelApiKey {
|
|
|
141
156
|
```
|
|
142
157
|
|
|
143
158
|
#### Response
|
|
159
|
+
|
|
144
160
|
```typescript
|
|
145
161
|
interface CreateCodespaceTaskResponseV2 {
|
|
146
162
|
success: boolean
|
|
@@ -152,18 +168,19 @@ interface CreateCodespaceTaskResponseV2 {
|
|
|
152
168
|
```
|
|
153
169
|
|
|
154
170
|
#### Example
|
|
171
|
+
|
|
155
172
|
```typescript
|
|
156
173
|
const response = await codespace.createCodespaceTaskV2({
|
|
157
|
-
project_id:
|
|
158
|
-
task_description:
|
|
159
|
-
execution_mode:
|
|
174
|
+
project_id: 'proj_123456',
|
|
175
|
+
task_description: 'Add user profile page with avatar upload and bio editing',
|
|
176
|
+
execution_mode: 'implementation',
|
|
160
177
|
model_api_keys: [
|
|
161
178
|
{
|
|
162
|
-
model_name:
|
|
163
|
-
api_key:
|
|
164
|
-
}
|
|
179
|
+
model_name: 'claude-3-sonnet',
|
|
180
|
+
api_key: 'your_api_key_here',
|
|
181
|
+
},
|
|
165
182
|
],
|
|
166
|
-
github_token:
|
|
183
|
+
github_token: 'ghp_your_github_token',
|
|
167
184
|
})
|
|
168
185
|
|
|
169
186
|
console.log(`Task created with ID: ${response.task_id}`)
|
|
@@ -174,19 +191,22 @@ console.log(`Task created with ID: ${response.task_id}`)
|
|
|
174
191
|
Creates a codespace task that runs in the background, returning immediately with task details while work continues.
|
|
175
192
|
|
|
176
193
|
#### Signature
|
|
194
|
+
|
|
177
195
|
```typescript
|
|
178
196
|
async createBackgroundCodespaceTask(request: CreateBackgroundCodespaceTaskRequest): Promise<CreateBackgroundCodespaceTaskResponse>
|
|
179
197
|
```
|
|
180
198
|
|
|
181
199
|
#### Parameters
|
|
200
|
+
|
|
182
201
|
Same as `createCodespaceTaskV2()` - extends `CreateCodespaceTaskRequestV2`
|
|
183
202
|
|
|
184
203
|
#### Response
|
|
204
|
+
|
|
185
205
|
```typescript
|
|
186
206
|
interface CreateBackgroundCodespaceTaskResponse {
|
|
187
207
|
success: boolean
|
|
188
208
|
task_id: string
|
|
189
|
-
job_id: string
|
|
209
|
+
job_id: string // Background job ID for status checking
|
|
190
210
|
status: string
|
|
191
211
|
message: string
|
|
192
212
|
repository_connected: boolean
|
|
@@ -195,11 +215,12 @@ interface CreateBackgroundCodespaceTaskResponse {
|
|
|
195
215
|
```
|
|
196
216
|
|
|
197
217
|
#### Example
|
|
218
|
+
|
|
198
219
|
```typescript
|
|
199
220
|
const response = await codespace.createBackgroundCodespaceTask({
|
|
200
|
-
project_id:
|
|
201
|
-
task_description:
|
|
202
|
-
execution_mode:
|
|
221
|
+
project_id: 'proj_123456',
|
|
222
|
+
task_description: 'Implement real-time chat functionality',
|
|
223
|
+
execution_mode: 'implementation',
|
|
203
224
|
})
|
|
204
225
|
|
|
205
226
|
console.log(`Background task started: ${response.job_id}`)
|
|
@@ -211,14 +232,17 @@ console.log(`Background task started: ${response.job_id}`)
|
|
|
211
232
|
Retrieves a codespace task by its ID with full details.
|
|
212
233
|
|
|
213
234
|
#### Signature
|
|
235
|
+
|
|
214
236
|
```typescript
|
|
215
237
|
async getCodespaceTask(codespaceTaskId: string): Promise<GetCodespaceTaskResponse>
|
|
216
238
|
```
|
|
217
239
|
|
|
218
240
|
#### Parameters
|
|
241
|
+
|
|
219
242
|
- `codespaceTaskId` (string, required): The ID of the codespace task to retrieve
|
|
220
243
|
|
|
221
244
|
#### Response
|
|
245
|
+
|
|
222
246
|
```typescript
|
|
223
247
|
interface GetCodespaceTaskResponse {
|
|
224
248
|
status: string
|
|
@@ -259,8 +283,9 @@ interface CodespaceTaskData {
|
|
|
259
283
|
```
|
|
260
284
|
|
|
261
285
|
#### Example
|
|
286
|
+
|
|
262
287
|
```typescript
|
|
263
|
-
const response = await codespace.getCodespaceTask(
|
|
288
|
+
const response = await codespace.getCodespaceTask('task_789012')
|
|
264
289
|
const task = response.data
|
|
265
290
|
|
|
266
291
|
console.log(`Task: ${task.title}`)
|
|
@@ -278,23 +303,26 @@ if (task.pull_request_url) {
|
|
|
278
303
|
Retrieves all codespace tasks for a specific project with filtering and pagination support.
|
|
279
304
|
|
|
280
305
|
#### Signature
|
|
306
|
+
|
|
281
307
|
```typescript
|
|
282
308
|
async getCodespaceTasksByProject(params: GetCodespaceTasksByProjectRequest): Promise<GetCodespaceTasksByProjectResponse>
|
|
283
309
|
```
|
|
284
310
|
|
|
285
311
|
#### Parameters
|
|
312
|
+
|
|
286
313
|
```typescript
|
|
287
314
|
interface GetCodespaceTasksByProjectRequest {
|
|
288
|
-
project_id: string
|
|
315
|
+
project_id: string // Required
|
|
289
316
|
status?: 'completed' | 'failed' | 'in_progress' | 'created' | 'cancelled'
|
|
290
|
-
limit?: number
|
|
291
|
-
offset?: number
|
|
292
|
-
sort_by?: string
|
|
293
|
-
sort_order?: 'asc' | 'desc'
|
|
317
|
+
limit?: number // Optional (default: 50)
|
|
318
|
+
offset?: number // Optional (default: 0)
|
|
319
|
+
sort_by?: string // Optional (default: "created_at")
|
|
320
|
+
sort_order?: 'asc' | 'desc' // Optional (default: "desc")
|
|
294
321
|
}
|
|
295
322
|
```
|
|
296
323
|
|
|
297
324
|
#### Response
|
|
325
|
+
|
|
298
326
|
```typescript
|
|
299
327
|
interface GetCodespaceTasksByProjectResponse {
|
|
300
328
|
status: string
|
|
@@ -305,13 +333,14 @@ interface GetCodespaceTasksByProjectResponse {
|
|
|
305
333
|
```
|
|
306
334
|
|
|
307
335
|
#### Example
|
|
336
|
+
|
|
308
337
|
```typescript
|
|
309
338
|
// Get all completed tasks for a project
|
|
310
339
|
const response = await codespace.getCodespaceTasksByProject({
|
|
311
|
-
project_id:
|
|
312
|
-
status:
|
|
340
|
+
project_id: 'proj_123456',
|
|
341
|
+
status: 'completed',
|
|
313
342
|
limit: 20,
|
|
314
|
-
sort_order:
|
|
343
|
+
sort_order: 'desc',
|
|
315
344
|
})
|
|
316
345
|
|
|
317
346
|
console.log(`Found ${response.total_count} completed tasks`)
|
|
@@ -325,30 +354,34 @@ response.data.forEach(task => {
|
|
|
325
354
|
Retrieves comprehensive codespace task details including related project data, repository information, and usage statistics.
|
|
326
355
|
|
|
327
356
|
#### Signature
|
|
357
|
+
|
|
328
358
|
```typescript
|
|
329
359
|
async getCodespaceTaskDetailed(codespaceTaskId: string): Promise<CodespaceTaskDetailedResponse>
|
|
330
360
|
```
|
|
331
361
|
|
|
332
362
|
#### Parameters
|
|
363
|
+
|
|
333
364
|
- `codespaceTaskId` (string, required): The ID of the codespace task to retrieve detailed information for
|
|
334
365
|
|
|
335
366
|
#### Response
|
|
367
|
+
|
|
336
368
|
```typescript
|
|
337
369
|
interface CodespaceTaskDetailedResponse {
|
|
338
370
|
status: string
|
|
339
371
|
data: {
|
|
340
372
|
task: CodespaceTaskData
|
|
341
|
-
project: any
|
|
342
|
-
repository: any
|
|
343
|
-
usage_summary: any
|
|
373
|
+
project: any // Project data structure
|
|
374
|
+
repository: any // Repository data structure
|
|
375
|
+
usage_summary: any // Usage statistics
|
|
344
376
|
}
|
|
345
377
|
message: string
|
|
346
378
|
}
|
|
347
379
|
```
|
|
348
380
|
|
|
349
381
|
#### Example
|
|
382
|
+
|
|
350
383
|
```typescript
|
|
351
|
-
const response = await codespace.getCodespaceTaskDetailed(
|
|
384
|
+
const response = await codespace.getCodespaceTaskDetailed('task_789012')
|
|
352
385
|
const { task, project, repository, usage_summary } = response.data
|
|
353
386
|
|
|
354
387
|
console.log(`Task: ${task.title}`)
|
|
@@ -362,24 +395,28 @@ console.log(`Usage: ${usage_summary.total_requests} requests`)
|
|
|
362
395
|
Retrieves project tasks associated with a specific codespace task.
|
|
363
396
|
|
|
364
397
|
#### Signature
|
|
398
|
+
|
|
365
399
|
```typescript
|
|
366
400
|
async getProjectTasksByCodespace(codespaceTaskId: string): Promise<GetProjectTasksByCodespaceResponse>
|
|
367
401
|
```
|
|
368
402
|
|
|
369
403
|
#### Parameters
|
|
404
|
+
|
|
370
405
|
- `codespaceTaskId` (string, required): The ID of the codespace task
|
|
371
406
|
|
|
372
407
|
#### Response
|
|
408
|
+
|
|
373
409
|
```typescript
|
|
374
410
|
interface GetProjectTasksByCodespaceResponse {
|
|
375
411
|
status: string
|
|
376
|
-
data: any[]
|
|
412
|
+
data: any[] // Array of project task objects
|
|
377
413
|
}
|
|
378
414
|
```
|
|
379
415
|
|
|
380
416
|
#### Example
|
|
417
|
+
|
|
381
418
|
```typescript
|
|
382
|
-
const response = await codespace.getProjectTasksByCodespace(
|
|
419
|
+
const response = await codespace.getProjectTasksByCodespace('task_789012')
|
|
383
420
|
|
|
384
421
|
console.log(`Found ${response.data.length} related project tasks`)
|
|
385
422
|
response.data.forEach(projectTask => {
|
|
@@ -387,11 +424,426 @@ response.data.forEach(projectTask => {
|
|
|
387
424
|
})
|
|
388
425
|
```
|
|
389
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
|
+
|
|
390
841
|
## Error Handling
|
|
391
842
|
|
|
392
843
|
All methods throw errors for various failure conditions. Common error types include:
|
|
393
844
|
|
|
394
845
|
### Validation Errors
|
|
846
|
+
|
|
395
847
|
```typescript
|
|
396
848
|
try {
|
|
397
849
|
await codespace.createCodespaceTaskV2({})
|
|
@@ -401,27 +853,29 @@ try {
|
|
|
401
853
|
```
|
|
402
854
|
|
|
403
855
|
### Network/Server Errors
|
|
856
|
+
|
|
404
857
|
```typescript
|
|
405
858
|
try {
|
|
406
|
-
await codespace.getCodespaceTask(
|
|
859
|
+
await codespace.getCodespaceTask('invalid_id')
|
|
407
860
|
} catch (error) {
|
|
408
861
|
if (error.response?.status === 404) {
|
|
409
|
-
console.error(
|
|
862
|
+
console.error('Task not found')
|
|
410
863
|
} else if (error.response?.status === 401) {
|
|
411
|
-
console.error(
|
|
864
|
+
console.error('Unauthorized - check your API credentials')
|
|
412
865
|
} else {
|
|
413
|
-
console.error(
|
|
866
|
+
console.error('Network error:', error.message)
|
|
414
867
|
}
|
|
415
868
|
}
|
|
416
869
|
```
|
|
417
870
|
|
|
418
871
|
### Timeout Errors
|
|
872
|
+
|
|
419
873
|
```typescript
|
|
420
874
|
try {
|
|
421
875
|
await codespace.createCodespaceTaskV2(largeRequest)
|
|
422
876
|
} catch (error) {
|
|
423
877
|
if (error.code === 'ECONNABORTED') {
|
|
424
|
-
console.error(
|
|
878
|
+
console.error('Request timed out. Consider using background task creation.')
|
|
425
879
|
}
|
|
426
880
|
}
|
|
427
881
|
```
|
|
@@ -435,30 +889,32 @@ import { CodeGuide } from '@codeguide/core'
|
|
|
435
889
|
|
|
436
890
|
const codeguide = new CodeGuide({
|
|
437
891
|
baseUrl: 'https://api.codeguide.dev',
|
|
438
|
-
databaseApiKey: process.env.CODEGUIDE_API_KEY
|
|
892
|
+
databaseApiKey: process.env.CODEGUIDE_API_KEY,
|
|
439
893
|
})
|
|
440
894
|
|
|
441
895
|
async function completeTaskWorkflow() {
|
|
442
896
|
try {
|
|
443
897
|
// 1. Generate a title from description
|
|
444
898
|
const titleResponse = await codeguide.codespace.generateTaskTitle({
|
|
445
|
-
task_description:
|
|
899
|
+
task_description:
|
|
900
|
+
'Implement a REST API for user management with CRUD operations, validation, and authentication middleware',
|
|
446
901
|
})
|
|
447
902
|
|
|
448
903
|
console.log(`Generated title: ${titleResponse.title}`)
|
|
449
904
|
|
|
450
905
|
// 2. Create the task
|
|
451
906
|
const taskResponse = await codeguide.codespace.createCodespaceTaskV2({
|
|
452
|
-
project_id:
|
|
453
|
-
task_description:
|
|
907
|
+
project_id: 'proj_123456',
|
|
908
|
+
task_description:
|
|
909
|
+
'Implement a REST API for user management with CRUD operations, validation, and authentication middleware',
|
|
454
910
|
title: titleResponse.title,
|
|
455
|
-
execution_mode:
|
|
911
|
+
execution_mode: 'implementation',
|
|
456
912
|
model_api_keys: [
|
|
457
913
|
{
|
|
458
|
-
model_name:
|
|
459
|
-
api_key: process.env.CLAUDE_API_KEY
|
|
460
|
-
}
|
|
461
|
-
]
|
|
914
|
+
model_name: 'claude-3-sonnet',
|
|
915
|
+
api_key: process.env.CLAUDE_API_KEY,
|
|
916
|
+
},
|
|
917
|
+
],
|
|
462
918
|
})
|
|
463
919
|
|
|
464
920
|
console.log(`Task created: ${taskResponse.task_id}`)
|
|
@@ -478,9 +934,8 @@ async function completeTaskWorkflow() {
|
|
|
478
934
|
}
|
|
479
935
|
|
|
480
936
|
checkProgress()
|
|
481
|
-
|
|
482
937
|
} catch (error) {
|
|
483
|
-
console.error(
|
|
938
|
+
console.error('Workflow failed:', error.message)
|
|
484
939
|
}
|
|
485
940
|
}
|
|
486
941
|
|
|
@@ -494,9 +949,9 @@ async function backgroundTaskExample() {
|
|
|
494
949
|
try {
|
|
495
950
|
// Create background task
|
|
496
951
|
const response = await codeguide.codespace.createBackgroundCodespaceTask({
|
|
497
|
-
project_id:
|
|
498
|
-
task_description:
|
|
499
|
-
execution_mode:
|
|
952
|
+
project_id: 'proj_123456',
|
|
953
|
+
task_description: 'Add comprehensive test suite for existing authentication module',
|
|
954
|
+
execution_mode: 'implementation',
|
|
500
955
|
})
|
|
501
956
|
|
|
502
957
|
console.log(`Background task started: ${response.job_id}`)
|
|
@@ -509,20 +964,21 @@ async function backgroundTaskExample() {
|
|
|
509
964
|
console.log(`Status: ${task.data.status}`)
|
|
510
965
|
|
|
511
966
|
if (['completed', 'failed'].includes(task.data.status)) {
|
|
512
|
-
console.log(
|
|
967
|
+
console.log(
|
|
968
|
+
`Task ${task.data.status === 'completed' ? 'completed successfully' : 'failed'}`
|
|
969
|
+
)
|
|
513
970
|
return
|
|
514
971
|
}
|
|
515
972
|
|
|
516
973
|
setTimeout(pollStatus, 10000) // Poll every 10 seconds
|
|
517
974
|
} catch (error) {
|
|
518
|
-
console.error(
|
|
975
|
+
console.error('Error checking status:', error.message)
|
|
519
976
|
}
|
|
520
977
|
}
|
|
521
978
|
|
|
522
979
|
pollStatus()
|
|
523
|
-
|
|
524
980
|
} catch (error) {
|
|
525
|
-
console.error(
|
|
981
|
+
console.error('Background task creation failed:', error.message)
|
|
526
982
|
}
|
|
527
983
|
}
|
|
528
984
|
```
|
|
@@ -531,14 +987,14 @@ async function backgroundTaskExample() {
|
|
|
531
987
|
|
|
532
988
|
```typescript
|
|
533
989
|
async function projectTaskManagement() {
|
|
534
|
-
const projectId =
|
|
990
|
+
const projectId = 'proj_123456'
|
|
535
991
|
|
|
536
992
|
try {
|
|
537
993
|
// Get all tasks for the project
|
|
538
994
|
const tasksResponse = await codeguide.codespace.getCodespaceTasksByProject({
|
|
539
995
|
project_id: projectId,
|
|
540
996
|
limit: 100,
|
|
541
|
-
sort_order:
|
|
997
|
+
sort_order: 'desc',
|
|
542
998
|
})
|
|
543
999
|
|
|
544
1000
|
console.log(`Project has ${tasksResponse.total_count} total tasks`)
|
|
@@ -549,7 +1005,7 @@ async function projectTaskManagement() {
|
|
|
549
1005
|
return acc
|
|
550
1006
|
}, {})
|
|
551
1007
|
|
|
552
|
-
console.log(
|
|
1008
|
+
console.log('Tasks by status:', tasksByStatus)
|
|
553
1009
|
|
|
554
1010
|
// Get detailed info for the most recent task
|
|
555
1011
|
if (tasksResponse.data.length > 0) {
|
|
@@ -560,9 +1016,8 @@ async function projectTaskManagement() {
|
|
|
560
1016
|
console.log(`Project: ${detailedResponse.data.project.name}`)
|
|
561
1017
|
console.log(`Repository: ${detailedResponse.data.repository?.repo_url || 'No repository'}`)
|
|
562
1018
|
}
|
|
563
|
-
|
|
564
1019
|
} catch (error) {
|
|
565
|
-
console.error(
|
|
1020
|
+
console.error('Project task management failed:', error.message)
|
|
566
1021
|
}
|
|
567
1022
|
}
|
|
568
1023
|
```
|
|
@@ -585,17 +1040,39 @@ The package exports the following types for TypeScript users:
|
|
|
585
1040
|
import type {
|
|
586
1041
|
CreateCodespaceTaskRequest,
|
|
587
1042
|
CreateCodespaceTaskResponse,
|
|
1043
|
+
CreateCodespaceTaskRequestV2,
|
|
1044
|
+
CreateCodespaceTaskResponseV2,
|
|
588
1045
|
CreateBackgroundCodespaceTaskRequest,
|
|
589
1046
|
CreateBackgroundCodespaceTaskResponse,
|
|
590
1047
|
ModelApiKey,
|
|
1048
|
+
Attachment,
|
|
591
1049
|
GetCodespaceTaskResponse,
|
|
592
1050
|
CodespaceTaskData,
|
|
593
1051
|
TechnicalDocument,
|
|
594
1052
|
GetProjectTasksByCodespaceResponse,
|
|
595
1053
|
GetCodespaceTasksByProjectRequest,
|
|
596
1054
|
GetCodespaceTasksByProjectResponse,
|
|
597
|
-
CodespaceTaskDetailedResponse
|
|
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,
|
|
598
1069
|
} from '@codeguide/core'
|
|
599
1070
|
```
|
|
600
1071
|
|
|
601
|
-
|
|
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
|
+
|
|
1078
|
+
For more information, visit the [API documentation](https://docs.codeguide.dev) or check the [GitHub repository](https://github.com/codeguide/cli).
|