create_repository
Create an empty Codeup repository for your project, ready to push code via git.
Instructions
[Code Management] Create a new Codeup repository.
Creates an empty code repository that can then be pushed to via git.
Use Cases:
Create a new repository for a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID, can be found in the basic information page of the organization admin console | |
| name | Yes | Repository name, e.g. my-repo | |
| path | Yes | Repository path, e.g. my-repo | |
| description | No | Repository description, max 65535 characters | |
| namespaceId | No | Parent path ID (namespace). If empty, created under the organization root | |
| visibility | No | Repository visibility: private or internal | |
| avatarUrl | No | Repository avatar URL | |
| readMeType | No | Type of README to auto-create: EMPTY or USER_GUIDE | |
| templateProject | No | Create repository from template |
Implementation Reference
- Main handler function that creates a codeup repository by calling the API. Builds the request body from params, sends a POST request, and returns the parsed repository response.
export async function createRepositoryFunc( organizationId: string | undefined, params: z.infer<typeof CreateRepositorySchema> ): Promise<z.infer<typeof RepositorySchema>> { const finalOrgId = await resolveOrganizationId(organizationId); const baseUrl = isRegionEdition() ? `/oapi/v1/codeup/repositories` : `/oapi/v1/codeup/organizations/${finalOrgId}/repositories`; const body: Record<string, unknown> = { name: params.name, path: params.path, }; if (params.description) body.description = params.description; if (params.namespaceId) body.namespaceId = params.namespaceId; if (params.visibility) body.visibility = params.visibility; if (params.avatarUrl) body.avatarUrl = params.avatarUrl; if (params.readMeType) body.readMeType = params.readMeType; if (params.templateProject) body.templateProject = params.templateProject; const url = buildUrl(baseUrl, { createParentPath: "true" }); const response = await yunxiaoRequest(url, { method: "POST", body, }); return RepositorySchema.parse(response); } - tool-handlers/code-management.ts:184-193 (handler)Tool handler case for 'create_repository'. Parses the input via CreateRepositorySchema, calls createRepositoryFunc, and returns the result as JSON text content.
case "create_repository": { const args = types.CreateRepositorySchema.parse(request.params.arguments); const repository = await repositories.createRepositoryFunc( args.organizationId, args ); return { content: [{ type: "text", text: JSON.stringify(repository, null, 2) }], }; } - operations/codeup/types.ts:269-279 (schema)Zod schema for CreateRepositorySchema defining all input parameters: organizationId (required), name (required), path (required), and optional fields like description, namespaceId, visibility, avatarUrl, readMeType, and templateProject.
export const CreateRepositorySchema = z.object({ organizationId: z.string().describe("Organization ID, can be found in the basic information page of the organization admin console"), name: z.string().describe("Repository name, e.g. my-repo"), path: z.string().describe("Repository path, e.g. my-repo"), description: z.string().optional().describe("Repository description, max 65535 characters"), namespaceId: z.number().int().optional().describe("Parent path ID (namespace). If empty, created under the organization root"), visibility: z.enum(["private", "internal"]).optional().describe("Repository visibility: private or internal"), avatarUrl: z.string().optional().describe("Repository avatar URL"), readMeType: z.enum(["EMPTY", "USER_GUIDE"]).optional().describe("Type of README to auto-create: EMPTY or USER_GUIDE"), templateProject: DevopsRepositoryTemplateCreateDTOSchema.optional().nullable().describe("Create repository from template"), }); - tool-registry/code-management.ts:77-87 (registration)Tool registration entry for 'create_repository' with its name, description, and inputSchema referencing CreateRepositorySchema.
{ name: "create_repository", description: "[Code Management] Create a new Codeup repository.\n" + "\n" + "Creates an empty code repository that can then be pushed to via git.\n" + "\n" + "Use Cases:\n" + "\n" + "Create a new repository for a project", inputSchema: zodToJsonSchema(types.CreateRepositorySchema), }, - common/types.ts:49-53 (helper)Re-exports CreateRepositorySchema from operations/codeup/types.ts so it can be used by both tool-handlers and tool-registry.
// Repository schemas GetRepositorySchema, ListRepositoriesSchema, CreateRepositorySchema,