list_commits
Retrieve commit history from an Alibaba Cloud Codeup repository to track code changes, filter by date, author, or file path, and monitor development progress.
Instructions
[Code Management] List commits in a Codeup repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | 组织ID | |
| repositoryId | Yes | 代码库ID或者URL-Encoder编码的全路径 | |
| refName | Yes | 分支名称、标签名称或提交版本,默认为代码库默认分支 | |
| since | No | 提交起始时间,格式:YYYY-MM-DDTHH:MM:SSZ | |
| until | No | 提交截止时间,格式:YYYY-MM-DDTHH:MM:SSZ | |
| page | No | 页码 | |
| perPage | No | 每页大小 | |
| path | No | 文件路径 | |
| search | No | 搜索关键字 | |
| showSignature | No | 是否展示签名 | |
| committerIds | No | 提交人ID列表(多个ID以逗号隔开) |
Implementation Reference
- tool-handlers/commit.ts:18-23 (handler)Handler logic for the 'list_commits' tool: parses input parameters using the schema, calls the listCommits function, and formats the response as JSON text.case 'list_commits': const listCommitsParams = ListCommitsRequestSchema.parse(request.params.arguments); const listCommitsResult = await listCommits(listCommitsParams); return { content: [{ type: "text", text: JSON.stringify(listCommitsResult, null, 2) }], };
- tool-registry/commit.ts:11-14 (registration)Registration of the 'list_commits' tool, including name, description, and input schema.name: 'list_commits', description: '[Code Management] List commits in a Codeup repository', inputSchema: zodToJsonSchema(ListCommitsRequestSchema), },
- operations/codeup/commits.ts:8-20 (schema)Zod schema definition for ListCommitsRequestSchema used for input validation.export const ListCommitsRequestSchema = z.object({ organizationId: z.string().describe("组织ID"), repositoryId: z.string().describe("代码库ID或者URL-Encoder编码的全路径"), refName: z.string().describe("分支名称、标签名称或提交版本,默认为代码库默认分支"), since: z.string().optional().describe("提交起始时间,格式:YYYY-MM-DDTHH:MM:SSZ"), until: z.string().optional().describe("提交截止时间,格式:YYYY-MM-DDTHH:MM:SSZ"), page: z.number().int().optional().describe("页码"), perPage: z.number().int().optional().describe("每页大小"), path: z.string().optional().describe("文件路径"), search: z.string().optional().describe("搜索关键字"), showSignature: z.boolean().optional().describe("是否展示签名"), committerIds: z.string().optional().describe("提交人ID列表(多个ID以逗号隔开)"), });
- operations/codeup/commits.ts:62-128 (helper)Core implementation of listCommits: builds API URL with query params, makes GET request to Codeup API, parses and returns list of commits.export async function listCommits(params: z.infer<typeof ListCommitsRequestSchema>) { const { organizationId, repositoryId, refName, since, until, page, perPage, path, search, showSignature, committerIds } = params; const encodedRepoId = handleRepositoryIdEncoding(repositoryId); const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/commits`; const queryParams: Record<string, string | number | undefined> = { refName: refName }; if (since !== undefined) { queryParams.since = since; } if (until !== undefined) { queryParams.until = until; } if (page !== undefined) { queryParams.page = page; } if (perPage !== undefined) { queryParams.perPage = perPage; } if (path !== undefined) { queryParams.path = path; } if (search !== undefined) { queryParams.search = search; } if (showSignature !== undefined) { queryParams.showSignature = String(showSignature); } if (committerIds !== undefined) { queryParams.committerIds = committerIds; } const url = buildUrl(baseUrl, queryParams); const response: any = await yunxiaoRequest(url, { method: "GET", }); if (!Array.isArray(response)) { return []; } return response.map(commit => DevopsCommitVOSchemaType.parse(commit)); }