@codeguide/core 0.0.42 → 0.0.44

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.
@@ -81,7 +81,12 @@ class ProjectService extends base_service_1.BaseService {
81
81
  throw new Error('Branch name contains invalid characters');
82
82
  }
83
83
  // Validate GitHub token format if provided
84
- if (request.github_token && !request.github_token.startsWith('ghp_') && !request.github_token.startsWith('gho_') && !request.github_token.startsWith('ghu_') && !request.github_token.startsWith('ghs_') && !request.github_token.startsWith('ghr_')) {
84
+ if (request.github_token &&
85
+ !request.github_token.startsWith('ghp_') &&
86
+ !request.github_token.startsWith('gho_') &&
87
+ !request.github_token.startsWith('ghu_') &&
88
+ !request.github_token.startsWith('ghs_') &&
89
+ !request.github_token.startsWith('ghr_')) {
85
90
  throw new Error('GitHub token must be a valid personal access token');
86
91
  }
87
92
  }
@@ -91,7 +96,7 @@ class ProjectService extends base_service_1.BaseService {
91
96
  queryParams.append('key', params.key);
92
97
  if (params?.category)
93
98
  queryParams.append('category', params.category);
94
- const url = `/ai-tools${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
99
+ const url = `/ai-tools/${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
95
100
  return this.get(url);
96
101
  }
97
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeguide/core",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "Core package for code guidance with programmatic API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,8 @@ export class ProjectService extends BaseService {
39
39
  if (params.start_date) queryParams.append('start_date', params.start_date)
40
40
  if (params.end_date) queryParams.append('end_date', params.end_date)
41
41
  if (params.sort_by_date) queryParams.append('sort_by_date', params.sort_by_date)
42
- if (params.has_repository !== undefined) queryParams.append('has_repository', params.has_repository.toString())
42
+ if (params.has_repository !== undefined)
43
+ queryParams.append('has_repository', params.has_repository.toString())
43
44
 
44
45
  const url = `/projects/paginated${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
45
46
  return this.get<PaginatedProjectsResponse>(url)
@@ -82,7 +83,9 @@ export class ProjectService extends BaseService {
82
83
  projectId: string,
83
84
  documentType: string
84
85
  ): Promise<GetProjectDocumentsResponse> {
85
- return this.get<GetProjectDocumentsResponse>(`/projects/${projectId}/documents/type/${documentType}`)
86
+ return this.get<GetProjectDocumentsResponse>(
87
+ `/projects/${projectId}/documents/type/${documentType}`
88
+ )
86
89
  }
87
90
 
88
91
  async connectRepository(
@@ -90,7 +93,10 @@ export class ProjectService extends BaseService {
90
93
  request: ConnectRepositoryRequest
91
94
  ): Promise<ConnectRepositoryResponse> {
92
95
  this.validateConnectRepositoryRequest(request)
93
- const response = await this.post<ConnectRepositoryResponse>(`/projects/${projectId}/repository`, request)
96
+ const response = await this.post<ConnectRepositoryResponse>(
97
+ `/projects/${projectId}/repository`,
98
+ request
99
+ )
94
100
  return response
95
101
  }
96
102
 
@@ -106,7 +112,9 @@ export class ProjectService extends BaseService {
106
112
  // Validate GitHub URL format
107
113
  const githubUrlPattern = /^https:\/\/github\.com\/[^\/]+\/[^\/]+\/?$/
108
114
  if (!githubUrlPattern.test(request.repo_url)) {
109
- throw new Error('Repository URL must be a valid GitHub URL (e.g., https://github.com/user/repo)')
115
+ throw new Error(
116
+ 'Repository URL must be a valid GitHub URL (e.g., https://github.com/user/repo)'
117
+ )
110
118
  }
111
119
 
112
120
  // Validate branch name format (basic validation)
@@ -115,7 +123,14 @@ export class ProjectService extends BaseService {
115
123
  }
116
124
 
117
125
  // Validate GitHub token format if provided
118
- if (request.github_token && !request.github_token.startsWith('ghp_') && !request.github_token.startsWith('gho_') && !request.github_token.startsWith('ghu_') && !request.github_token.startsWith('ghs_') && !request.github_token.startsWith('ghr_')) {
126
+ if (
127
+ request.github_token &&
128
+ !request.github_token.startsWith('ghp_') &&
129
+ !request.github_token.startsWith('gho_') &&
130
+ !request.github_token.startsWith('ghu_') &&
131
+ !request.github_token.startsWith('ghs_') &&
132
+ !request.github_token.startsWith('ghr_')
133
+ ) {
119
134
  throw new Error('GitHub token must be a valid personal access token')
120
135
  }
121
136
  }
@@ -126,7 +141,7 @@ export class ProjectService extends BaseService {
126
141
  if (params?.key) queryParams.append('key', params.key)
127
142
  if (params?.category) queryParams.append('category', params.category)
128
143
 
129
- const url = `/ai-tools${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
144
+ const url = `/ai-tools/${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
130
145
  return this.get<GetAiToolsResponse>(url)
131
146
  }
132
147
  }