@codeguide/core 0.0.28 → 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.
Files changed (79) hide show
  1. package/__tests__/services/usage/usage-service.test.ts +442 -83
  2. package/codeguide.ts +3 -0
  3. package/dist/codeguide.d.ts +2 -1
  4. package/dist/codeguide.js +1 -0
  5. package/dist/index.d.ts +4 -3
  6. package/dist/services/base/base-service.d.ts +21 -0
  7. package/dist/services/base/base-service.js +114 -0
  8. package/dist/services/codespace/codespace-service.d.ts +55 -1
  9. package/dist/services/codespace/codespace-service.js +257 -0
  10. package/dist/services/codespace/codespace-types.d.ts +192 -12
  11. package/dist/services/codespace/index.d.ts +1 -1
  12. package/dist/services/index.d.ts +2 -0
  13. package/dist/services/index.js +4 -1
  14. package/dist/services/projects/project-types.d.ts +66 -32
  15. package/dist/services/starter-kits/index.d.ts +2 -0
  16. package/dist/services/starter-kits/index.js +20 -0
  17. package/dist/services/starter-kits/starter-kits-service.d.ts +13 -0
  18. package/dist/services/starter-kits/starter-kits-service.js +27 -0
  19. package/dist/services/starter-kits/starter-kits-types.d.ts +34 -0
  20. package/dist/services/starter-kits/starter-kits-types.js +2 -0
  21. package/dist/services/tasks/task-service.d.ts +2 -1
  22. package/dist/services/tasks/task-service.js +8 -0
  23. package/dist/services/tasks/task-types.d.ts +26 -7
  24. package/dist/services/usage/usage-service.d.ts +5 -2
  25. package/dist/services/usage/usage-service.js +58 -9
  26. package/dist/services/usage/usage-types.d.ts +150 -26
  27. package/docs/.vitepress/README.md +51 -0
  28. package/docs/.vitepress/config.ts +139 -0
  29. package/docs/.vitepress/theme/custom.css +80 -0
  30. package/docs/.vitepress/theme/index.ts +13 -0
  31. package/docs/.vitepress/tsconfig.json +19 -0
  32. package/docs/QUICKSTART.md +77 -0
  33. package/docs/README.md +134 -0
  34. package/docs/README_SETUP.md +46 -0
  35. package/docs/authentication.md +351 -0
  36. package/docs/codeguide-client.md +350 -0
  37. package/docs/codespace-models.md +1004 -0
  38. package/docs/codespace-service.md +444 -0
  39. package/docs/index.md +135 -0
  40. package/docs/package.json +14 -0
  41. package/docs/projects-service.md +688 -0
  42. package/docs/security-keys-service.md +773 -0
  43. package/docs/starter-kits-service.md +249 -0
  44. package/docs/task-service.md +955 -0
  45. package/docs/testsprite_tests/TC001_Homepage_Load_and_Hero_Section_Display.py +70 -0
  46. package/docs/testsprite_tests/TC002_Sidebar_Navigation_ExpandCollapse_Functionality.py +73 -0
  47. package/docs/testsprite_tests/TC003_Full_Text_Local_Search_with_Keyboard_Shortcut.py +90 -0
  48. package/docs/testsprite_tests/TC004_Dark_Mode_Toggle_and_Persistence.py +73 -0
  49. package/docs/testsprite_tests/TC005_Mobile_Responsiveness_and_Touch_Navigation.py +113 -0
  50. package/docs/testsprite_tests/TC006_GitHub_Integration_Edit_this_page_Links.py +73 -0
  51. package/docs/testsprite_tests/TC007_Syntax_Highlighting_and_Code_Copy_Functionality.py +73 -0
  52. package/docs/testsprite_tests/TC008_Auto_Generated_Table_of_Contents_Accuracy.py +73 -0
  53. package/docs/testsprite_tests/TC009_SEO_and_Content_Discoverability_Verification.py +73 -0
  54. package/docs/testsprite_tests/TC010_Accessibility_Compliance_WCAG_AA.py +73 -0
  55. package/docs/testsprite_tests/TC011_Local_Development_Workflow_Build_and_Hot_Reload.py +74 -0
  56. package/docs/testsprite_tests/TC012_Performance_Metrics_Compliance.py +73 -0
  57. package/docs/testsprite_tests/standard_prd.json +122 -0
  58. package/docs/testsprite_tests/testsprite-mcp-test-report.html +2508 -0
  59. package/docs/testsprite_tests/testsprite-mcp-test-report.md +273 -0
  60. package/docs/testsprite_tests/testsprite_frontend_test_plan.json +390 -0
  61. package/docs/usage-service.md +291 -1
  62. package/index.ts +11 -3
  63. package/package.json +16 -2
  64. package/plans/CODESPACE_LOGS_STREAMING_GUIDE.md +320 -0
  65. package/plans/CODESPACE_TASK_LOGS_API_COMPLETE_GUIDE.md +821 -0
  66. package/services/base/base-service.ts +130 -0
  67. package/services/codespace/codespace-service.ts +337 -0
  68. package/services/codespace/codespace-types.ts +262 -13
  69. package/services/codespace/index.ts +16 -1
  70. package/services/index.ts +2 -0
  71. package/services/projects/README.md +107 -34
  72. package/services/projects/project-types.ts +69 -32
  73. package/services/starter-kits/index.ts +2 -0
  74. package/services/starter-kits/starter-kits-service.ts +33 -0
  75. package/services/starter-kits/starter-kits-types.ts +38 -0
  76. package/services/tasks/task-service.ts +10 -0
  77. package/services/tasks/task-types.ts +29 -7
  78. package/services/usage/usage-service.ts +59 -10
  79. package/services/usage/usage-types.ts +178 -27
@@ -0,0 +1,249 @@
1
+ # Starter Kits Service
2
+
3
+ The Starter Kits Service provides methods for retrieving starter kits that can be used to bootstrap new projects.
4
+
5
+ ## Overview
6
+
7
+ The Starter Kits Service allows you to:
8
+ - Retrieve starter kits with optional filtering
9
+ - Filter starter kits by name or repository name
10
+ - Access starter kit metadata and project structures
11
+
12
+ ## Setup
13
+
14
+ ### Installation
15
+
16
+ ```bash
17
+ npm install @codeguide/core
18
+ ```
19
+
20
+ ### Basic Initialization
21
+
22
+ ```typescript
23
+ import { CodeGuide } from '@codeguide/core'
24
+
25
+ const codeguide = new CodeGuide({
26
+ baseUrl: 'https://api.codeguide.ai',
27
+ databaseApiKey: 'sk_your_database_api_key',
28
+ })
29
+
30
+ // Access the starter kits service
31
+ const starterKits = codeguide.starterKits
32
+ ```
33
+
34
+ ## Authentication
35
+
36
+ The service supports multiple authentication methods with automatic priority handling:
37
+
38
+ 1. **Database API Key** (recommended): `sk_...` format
39
+ 2. **Legacy API Key**: Older API key format
40
+ 3. **Clerk JWT Token**: JWT-based authentication
41
+
42
+ The service will automatically use the highest priority authentication method available.
43
+
44
+ ## Methods Overview
45
+
46
+ | Method | Description | Endpoint |
47
+ |--------|-------------|----------|
48
+ | `getStarterKits()` | Get starter kits with optional filtering | `GET /starter-kits/` |
49
+
50
+ ## Detailed Method Documentation
51
+
52
+ ### getStarterKits()
53
+
54
+ Retrieves starter kits with optional filtering by name or repository name. Results are ordered by `ordinal` in ascending order.
55
+
56
+ #### Signature
57
+
58
+ ```typescript
59
+ async getStarterKits(params?: GetStarterKitsRequest): Promise<StarterKit[]>
60
+ ```
61
+
62
+ #### Parameters
63
+
64
+ ```typescript
65
+ interface GetStarterKitsRequest {
66
+ name?: string // Optional: Filter by starter kit name
67
+ repo_name?: string // Optional: Filter by repository name
68
+ }
69
+ ```
70
+
71
+ #### Returns
72
+
73
+ - `Promise<StarterKit[]>`: Array of starter kit objects
74
+
75
+ #### StarterKit Interface
76
+
77
+ ```typescript
78
+ interface StarterKit {
79
+ id: string // Unique identifier (UUID)
80
+ created_at: string // Creation timestamp (ISO 8601)
81
+ updated_at: string // Last update timestamp (ISO 8601)
82
+ name: string // Starter kit name
83
+ repo_name: string | null // Repository name (optional)
84
+ kit_name: string | null // Kit name (optional)
85
+ metadata: StarterKitMetadata | null // Additional metadata (optional)
86
+ project_structure: string | null // Project structure information (optional)
87
+ ordinal: number | null // Ordering value (used for sorting)
88
+ }
89
+ ```
90
+
91
+ #### Example
92
+
93
+ ```typescript
94
+ // Get all starter kits
95
+ const allStarterKits = await codeguide.starterKits.getStarterKits()
96
+
97
+ console.log(`Found ${allStarterKits.length} starter kits`)
98
+ allStarterKits.forEach(kit => {
99
+ console.log(`- ${kit.name} (${kit.repo_name || 'No repo'})`)
100
+ })
101
+
102
+ // Filter by name
103
+ const reactKits = await codeguide.starterKits.getStarterKits({
104
+ name: 'react',
105
+ })
106
+
107
+ console.log(`Found ${reactKits.length} React starter kits`)
108
+
109
+ // Filter by repository name
110
+ const githubKits = await codeguide.starterKits.getStarterKits({
111
+ repo_name: 'github.com/example/repo',
112
+ })
113
+
114
+ // Combine filters
115
+ const filteredKits = await codeguide.starterKits.getStarterKits({
116
+ name: 'nextjs',
117
+ repo_name: 'github.com/vercel/next.js',
118
+ })
119
+ ```
120
+
121
+ ## Response Format
122
+
123
+ The API returns starter kits in the following format:
124
+
125
+ ```json
126
+ {
127
+ "status": "success",
128
+ "data": [
129
+ {
130
+ "id": "uuid",
131
+ "created_at": "2024-01-01T00:00:00Z",
132
+ "updated_at": "2024-01-01T00:00:00Z",
133
+ "name": "Next.js Starter",
134
+ "repo_name": "github.com/vercel/next.js",
135
+ "kit_name": "nextjs-starter",
136
+ "metadata": {
137
+ "framework": "nextjs",
138
+ "language": "typescript"
139
+ },
140
+ "project_structure": "src/\n app/\n components/\n lib/",
141
+ "ordinal": 1.0
142
+ }
143
+ ]
144
+ }
145
+ ```
146
+
147
+ ## Error Handling
148
+
149
+ The service handles errors automatically through the base service error handling:
150
+
151
+ - **401 Unauthorized**: Authentication failed
152
+ - **403 Forbidden**: Insufficient permissions
153
+ - **429 Too Many Requests**: Rate limit exceeded
154
+ - **500 Internal Server Error**: Server error
155
+
156
+ All errors are thrown as JavaScript `Error` objects with descriptive messages.
157
+
158
+ #### Example Error Handling
159
+
160
+ ```typescript
161
+ try {
162
+ const starterKits = await codeguide.starterKits.getStarterKits()
163
+ } catch (error) {
164
+ if (error.message.includes('Authentication failed')) {
165
+ console.error('Please check your API key')
166
+ } else if (error.message.includes('Rate limit')) {
167
+ console.error('Too many requests. Please wait before retrying.')
168
+ } else {
169
+ console.error('Error fetching starter kits:', error.message)
170
+ }
171
+ }
172
+ ```
173
+
174
+ ## Use Cases
175
+
176
+ ### Listing Available Starter Kits
177
+
178
+ ```typescript
179
+ // Get all available starter kits
180
+ const kits = await codeguide.starterKits.getStarterKits()
181
+
182
+ // Display them in order
183
+ kits.forEach((kit, index) => {
184
+ console.log(`${index + 1}. ${kit.name}`)
185
+ if (kit.repo_name) {
186
+ console.log(` Repository: ${kit.repo_name}`)
187
+ }
188
+ if (kit.metadata) {
189
+ console.log(` Metadata:`, kit.metadata)
190
+ }
191
+ })
192
+ ```
193
+
194
+ ### Finding a Specific Starter Kit
195
+
196
+ ```typescript
197
+ // Search for a specific starter kit
198
+ const nextjsKit = await codeguide.starterKits.getStarterKits({
199
+ name: 'nextjs',
200
+ })
201
+
202
+ if (nextjsKit.length > 0) {
203
+ const kit = nextjsKit[0]
204
+ console.log(`Found: ${kit.name}`)
205
+ if (kit.project_structure) {
206
+ console.log('Project structure:')
207
+ console.log(kit.project_structure)
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### Filtering by Repository
213
+
214
+ ```typescript
215
+ // Get starter kits from a specific repository
216
+ const repoKits = await codeguide.starterKits.getStarterKits({
217
+ repo_name: 'github.com/example/starters',
218
+ })
219
+
220
+ console.log(`Found ${repoKits.length} kits from the repository`)
221
+ ```
222
+
223
+ ## TypeScript Support
224
+
225
+ The service provides full TypeScript support with exported types:
226
+
227
+ ```typescript
228
+ import {
229
+ StarterKitsService,
230
+ StarterKit,
231
+ GetStarterKitsRequest,
232
+ GetStarterKitsResponse,
233
+ } from '@codeguide/core'
234
+
235
+ // Use types for better type safety
236
+ const request: GetStarterKitsRequest = {
237
+ name: 'react',
238
+ }
239
+
240
+ const kits: StarterKit[] = await codeguide.starterKits.getStarterKits(request)
241
+ ```
242
+
243
+ ## Notes
244
+
245
+ - Starter kits are ordered by `ordinal` in ascending order (lower values appear first)
246
+ - All query parameters are optional - omitting them will return all starter kits
247
+ - The `metadata` field can contain any JSON-serializable data
248
+ - The `project_structure` field typically contains a string representation of the directory structure
249
+