Skip to content

Commit 6cc0a9b

Browse files
openhands-agentTiberriver256
authored andcommitted
docs: update task status for get_repository_details
1 parent dcef80b commit 6cc0a9b

File tree

10 files changed

+78
-81
lines changed

10 files changed

+78
-81
lines changed
+1-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
11
## Current Task
22

3-
- [ ] **Task**: Implement get_repository_details core functionality
4-
- **Role**: Full-Stack Developer
5-
- **Phase**: Research
6-
- **Notes**:
7-
- Implement a handler to fetch detailed information about a specific Git repository in Azure DevOps
8-
- Include repository metadata, branch statistics, and refs information
9-
- Create appropriate tests and documentation
10-
- **Sub-tasks**:
11-
1. Create schema for get_repository_details
12-
2. Implement core functionality to fetch repository details
13-
3. Add support for branch statistics
14-
4. Add support for repository refs
15-
5. Write unit tests
16-
6. Write integration tests
17-
7. Update documentation
3+
No task is currently in progress. Please take the next task from todo.md.

project-management/task-management/done.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
## Completed Tasks
22

3+
- [x] **Task 3.1**: Implement get_repository_details core functionality
4+
- **Role**: Full-Stack Developer
5+
- **Phase**: Completed
6+
- **Notes**:
7+
- Implemented a handler to fetch detailed information about a specific Git repository in Azure DevOps
8+
- Added support for repository metadata, branch statistics, and refs information
9+
- Created unit tests and integration tests
10+
- Updated documentation
11+
- **Sub-tasks**:
12+
- [x] Created schema for get_repository_details
13+
- [x] Implemented core functionality to fetch repository details
14+
- [x] Added support for branch statistics
15+
- [x] Added support for repository refs
16+
- [x] Wrote unit tests
17+
- [x] Wrote integration tests
18+
- [x] Updated documentation
19+
- **Completed**: April 2, 2025
20+
321
- [x] **Task 2.8**: Allow `get_work_item` to default to 'Expand All' when no specific fields are requested. There isn't usually enough information on the default Get_work_item response now.
422
- **Role**: Full-Stack Developer
523
- **Phase**: Completed

src/features/repositories/get-repository-details/feature.spec.int.ts

+23-35
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ describe('getRepositoryDetails integration', () => {
4242
const testRepo = repos[0];
4343

4444
// Act - make an actual API call to Azure DevOps
45-
const result = await getRepositoryDetails(
46-
connection,
47-
{
48-
projectId: projectName,
49-
repositoryId: testRepo.name || testRepo.id || '',
50-
},
51-
);
45+
const result = await getRepositoryDetails(connection, {
46+
projectId: projectName,
47+
repositoryId: testRepo.name || testRepo.id || '',
48+
});
5249

5350
// Assert on the actual response
5451
expect(result).toBeDefined();
@@ -88,14 +85,11 @@ describe('getRepositoryDetails integration', () => {
8885
const testRepo = repos[0];
8986

9087
// Act - make an actual API call to Azure DevOps
91-
const result = await getRepositoryDetails(
92-
connection,
93-
{
94-
projectId: projectName,
95-
repositoryId: testRepo.name || testRepo.id || '',
96-
includeStatistics: true,
97-
},
98-
);
88+
const result = await getRepositoryDetails(connection, {
89+
projectId: projectName,
90+
repositoryId: testRepo.name || testRepo.id || '',
91+
includeStatistics: true,
92+
});
9993

10094
// Assert on the actual response
10195
expect(result).toBeDefined();
@@ -132,14 +126,11 @@ describe('getRepositoryDetails integration', () => {
132126
const testRepo = repos[0];
133127

134128
// Act - make an actual API call to Azure DevOps
135-
const result = await getRepositoryDetails(
136-
connection,
137-
{
138-
projectId: projectName,
139-
repositoryId: testRepo.name || testRepo.id || '',
140-
includeRefs: true,
141-
},
142-
);
129+
const result = await getRepositoryDetails(connection, {
130+
projectId: projectName,
131+
repositoryId: testRepo.name || testRepo.id || '',
132+
includeRefs: true,
133+
});
143134

144135
// Assert on the actual response
145136
expect(result).toBeDefined();
@@ -178,25 +169,22 @@ describe('getRepositoryDetails integration', () => {
178169
const testRepo = repos[0];
179170

180171
// Act - make an actual API call to Azure DevOps
181-
const result = await getRepositoryDetails(
182-
connection,
183-
{
184-
projectId: projectName,
185-
repositoryId: testRepo.name || testRepo.id || '',
186-
includeRefs: true,
187-
refFilter: 'heads/',
188-
},
189-
);
172+
const result = await getRepositoryDetails(connection, {
173+
projectId: projectName,
174+
repositoryId: testRepo.name || testRepo.id || '',
175+
includeRefs: true,
176+
refFilter: 'heads/',
177+
});
190178

191179
// Assert on the actual response
192180
expect(result).toBeDefined();
193181
expect(result.repository).toBeDefined();
194182
expect(result.refs).toBeDefined();
195183
expect(result.refs?.value).toBeDefined();
196-
184+
197185
// All refs should start with refs/heads/
198186
if (result.refs && result.refs.value.length > 0) {
199-
result.refs.value.forEach(ref => {
187+
result.refs.value.forEach((ref) => {
200188
expect(ref.name).toMatch(/^refs\/heads\//);
201189
});
202190
}
@@ -226,4 +214,4 @@ describe('getRepositoryDetails integration', () => {
226214
}),
227215
).rejects.toThrow(/not found|Failed to get repository/);
228216
});
229-
});
217+
});

src/features/repositories/get-repository-details/feature.spec.unit.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('getRepositoryDetails unit', () => {
182182
expect(getRefs).toHaveBeenCalledWith(
183183
mockRepository.id,
184184
'test-project',
185-
'heads/'
185+
'heads/',
186186
);
187187
});
188188

@@ -210,8 +210,8 @@ describe('getRepositoryDetails unit', () => {
210210
'test-project',
211211
{
212212
version: 'main',
213-
versionType: GitVersionType.Branch
214-
}
213+
versionType: GitVersionType.Branch,
214+
},
215215
);
216216
});
217217

@@ -305,4 +305,4 @@ describe('getRepositoryDetails unit', () => {
305305
expect(result.refs?.value).toEqual([]);
306306
expect(result.refs?.count).toBe(0);
307307
});
308-
});
308+
});

src/features/repositories/get-repository-details/feature.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ export async function getRepositoryDetails(
2020
): Promise<RepositoryDetails> {
2121
try {
2222
const gitApi = await connection.getGitApi();
23-
23+
2424
// Get the basic repository information
25-
const repository = await gitApi.getRepository(options.repositoryId, options.projectId);
25+
const repository = await gitApi.getRepository(
26+
options.repositoryId,
27+
options.projectId,
28+
);
2629

2730
if (!repository) {
2831
throw new AzureDevOpsResourceNotFoundError(
@@ -38,19 +41,19 @@ export async function getRepositoryDetails(
3841
// Get branch statistics if requested
3942
if (options.includeStatistics) {
4043
let baseVersionDescriptor = undefined;
41-
44+
4245
// If a specific branch name is provided, create a version descriptor for it
4346
if (options.branchName) {
4447
baseVersionDescriptor = {
4548
version: options.branchName,
46-
versionType: GitVersionType.Branch
49+
versionType: GitVersionType.Branch,
4750
};
4851
}
49-
52+
5053
const branchStats = await gitApi.getBranches(
5154
repository.id || '',
5255
options.projectId,
53-
baseVersionDescriptor
56+
baseVersionDescriptor,
5457
);
5558

5659
response.statistics = {
@@ -64,7 +67,7 @@ export async function getRepositoryDetails(
6467
const refs = await gitApi.getRefs(
6568
repository.id || '',
6669
options.projectId,
67-
filter
70+
filter,
6871
);
6972

7073
if (refs) {
@@ -89,4 +92,4 @@ export async function getRepositoryDetails(
8992
`Failed to get repository details: ${error instanceof Error ? error.message : String(error)}`,
9093
);
9194
}
92-
}
95+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './schema';
2-
export * from './feature';
2+
export * from './feature';
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { GetRepositoryDetailsSchema } from '../schemas';
22

3-
export { GetRepositoryDetailsSchema };
3+
export { GetRepositoryDetailsSchema };

src/features/repositories/schemas.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export const GetRepositoryDetailsSchema = z.object({
3131
branchName: z
3232
.string()
3333
.optional()
34-
.describe('Name of specific branch to get statistics for (if includeStatistics is true)'),
34+
.describe(
35+
'Name of specific branch to get statistics for (if includeStatistics is true)',
36+
),
3537
});
3638

3739
/**

src/features/repositories/types.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {
2-
GitRepository,
3-
GitBranchStats,
4-
GitRef
1+
import {
2+
GitRepository,
3+
GitBranchStats,
4+
GitRef,
55
} from 'azure-devops-node-api/interfaces/GitInterfaces';
66

77
/**

src/server.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ export function createAzureDevOpsServer(config: AzureDevOpsConfig): Server {
137137
},
138138
{
139139
name: 'get_repository_details',
140-
description: 'Get detailed information about a repository including statistics and refs',
140+
description:
141+
'Get detailed information about a repository including statistics and refs',
141142
inputSchema: zodToJsonSchema(GetRepositoryDetailsSchema),
142143
},
143144
{
@@ -276,18 +277,17 @@ export function createAzureDevOpsServer(config: AzureDevOpsConfig): Server {
276277
};
277278
}
278279
case 'get_repository_details': {
279-
const args = GetRepositoryDetailsSchema.parse(request.params.arguments);
280-
const result = await getRepositoryDetails(
281-
connection,
282-
{
283-
projectId: args.projectId,
284-
repositoryId: args.repositoryId,
285-
includeStatistics: args.includeStatistics,
286-
includeRefs: args.includeRefs,
287-
refFilter: args.refFilter,
288-
branchName: args.branchName,
289-
},
280+
const args = GetRepositoryDetailsSchema.parse(
281+
request.params.arguments,
290282
);
283+
const result = await getRepositoryDetails(connection, {
284+
projectId: args.projectId,
285+
repositoryId: args.repositoryId,
286+
includeStatistics: args.includeStatistics,
287+
includeRefs: args.includeRefs,
288+
refFilter: args.refFilter,
289+
branchName: args.branchName,
290+
});
291291
return {
292292
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
293293
};

0 commit comments

Comments
 (0)