Create a project
Code Mode: praxis.devops.projects.create
HTTP: POST /devops/v1/projects
Create a delivery project and its two default environments (develop, production). The code lives in one of two places. Our own Git: pass provider platform and package, the id (pkg_…) of a git package in your organization’s registry (the registry domain lists packages and creates git libraries); there is no install flow and no connection, the project records the provider, the package and the package’s default branch, and from then on pull requests, the merge gate, changes and cloud workspaces use that package and DevOps merges a pull request itself. A package backs at most one project (REPOSITORY_ALREADY_BOUND) and a package that is not a git package of your organization is INVALID_ARGUMENT. If the package has no default branch yet, which is usual for a library imported from elsewhere, pass initialRef, an existing branch such as import: the default branch is created at its head while the project is created, and no change can be opened before it exists. If the default branch already exists the call is refused with DEFAULT_BRANCH_EXISTS, and a missing initialRef branch with REF_NOT_FOUND; neither leaves a project behind. For a package whose project already exists, use devops.projects.initializeDefaultBranch instead. GitHub (the default): pass the connection of a completed GitHub App install and the repository (owner/name) it can see; leave both out to create a project with no repository yet. A name must be kebab-case and unused in the organization (PROJECT_NAME_TAKEN).
签名
praxis.devops.projects.create(args:{body:{/** Kebab-case name, unique within the organization. e.g. "praxis-beta" */ name:string;/** What the project is for, in your own words. e.g. "The Beta app on our own Git." */ description?:string;/** Where the code lives: github (the default) or platform, a git package of our own Git. e.g. "platform" */ provider?:"github"|"platform";/** provider platform only: the id of a git package of your organization's registry. pattern: ^pkg_[0-9a-f]{32}$ e.g. "pkg_0123456789abcdef0123456789abcdef" */ package?:string;/** provider platform only: an existing branch (for example import) to create the default branch from, when the package has none yet. e.g. "import" */ initialRef?:string;/** provider github only: the connection of a completed GitHub App install that can see the repository. e.g. "con_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ connection?:string;/** provider github only: the repository as owner/name. e.g. "deepractice/praxis" */ repository?:string;/** Delivery settings; keys you leave out take their defaults. */ settings?:{[key:string]:unknown};/** Idempotency key: repeat the call with the same value to be given the same answer. */ requestId?:string}}):Promise<{/** Project identifier used by every other operation of this domain, so it is the first thing to read from this answer. e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always project; it lets a caller tell answers of different kinds apart. */ object:"project";/** RFC 3339 UTC time the project was created; the project list is ordered by it, newest first. e.g. "2026-10-20T04:00:00Z" */ createTime:string;/** RFC 3339 UTC time the project or one of its settings last changed. e.g. "2026-11-03T09:15:00Z" */ updateTime:string;/** Canonical Console link for this project, for putting a human-readable reference in a card or a message. e.g. "https://console.deepraxis.com/devops/projects/dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** Short kebab-case name unique inside the organization, used to tell projects apart in conversation. e.g. "praxis" */ name:string;/** What this project is for, in the author's own words; absent when none was given. e.g. "The Praxis monorepo's delivery line." */ description?:string;/** The repository this project deploys from, or null when no repository is bound yet — a project without one can hold flags but cannot release or read targets. */ repository:null|{/** The git host serving this repository; the value decides how fullName is read. e.g. "github" */ provider:"github"|"platform";/** Owner and repository name as the git host spells them, which is what a person sees in a clone URL. e.g. "deepractice/praxis" */ fullName:string;/** The branch releases are built from and behindMain is measured against, usually main. e.g. "main" */ defaultBranch:string;/** The git host connection that authorizes reads of this repository; null for a repository on our own Git, which needs none. e.g. "con_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ connection:(string)|null;/** Whether the repository is private; a private one is only readable through its connection, never anonymously. e.g. true */ private:boolean;mirror:{/** Where the mirror stands; a failed mirror still lets releases run, because a release reads the git host directly. e.g. "fresh" */ state:"syncing"|"fresh"|"stale"|"failed";/** The commit the mirror held when it was last read; absent before the first read finished. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ headSha?:string;/** RFC 3339 UTC time of that last read; absent before the first read finished. e.g. "2026-11-03T09:14:30Z" */ syncTime?:string;/** Why the last read failed, present only while state is failed; it names the git host's own message rather than a summary. e.g. "GitHub returned 403 for this installation." */ error?:string}};settings:{/** The cron that cuts a release on its own, or null for a project that only releases when a person asks. */ releaseSchedule:null|{/** Five-field cron expression, read in timeZone; it decides the release's start, not how long the release takes. e.g. "0 9 * * 1-5" */ cron:string;/** IANA zone the cron is read in, so a schedule does not move when the clocks do. e.g. "Asia/Shanghai" */ timeZone:string};/** Not read, kept for old records: the observation window is the observeMinutes of the environment a promotion deploys into, which wins over this value. e.g. 60 */ observationWindowMinutes:number;/** Whether merging into the default branch promotes to the first environment by itself; false means every promotion is asked for explicitly. e.g. true */ autoDeployOnMerge:boolean;/** Whether this project accepts a bypass that skips upstream verification. e.g. false */ allowSkipUpstream:boolean;/** Whether the merge gate is registered with the git host as a required check; true means the host itself blocks a merge the gate has not passed. e.g. true */ requireGate:boolean;gate?:{/** How the merge gate's tests check reads on this project. e.g. "evidence" */ tests?:"evidence"|"off";/** One rule per gate check: its mode (enforce counts it, evaluate shows it without counting, off hides it) and whether an unavailable check blocks. */ rules?:Array<{/** The gate check this rule governs. e.g. "lockfile" */ check:string;/** enforce counts the check toward the gate, evaluate records it without counting, off drops it. e.g. "enforce" */ mode:"enforce"|"evaluate"|"off";/** What an unavailable check does: fail-closed blocks the gate, fail-open shows it without blocking. e.g. "fail-closed" */ whenUnavailable:"fail-closed"|"fail-open";/** The check's own parameters; passed through unread. */ params?:{[key:string]:unknown}}>;/** Subjects allowed to bypass the gate, as agent:<id> or human:<id>. */ bypass?:Array<string>};retention?:{/** Delete a pull request's branch as soon as it merges, as GitHub's automatic head-branch deletion does. e.g. true */ deleteMergedBranch?:boolean;/** Days a stopped unit whose change is still open is kept before it is deleted (the unit pushes its work to a WIP ref first and is kept when it cannot). e.g. 30 */ stoppedUnitDays?:number;/** Days test evidence rows are kept. e.g. 90 */ evidenceDays?:number;/** How many ready prebuilds each workspace keeps, newest first; older ones are archived and their snapshots deleted. e.g. 2 */ prebuildVersions?:number};deploy?:{/** Which version of the deploy engine (the published @deepraxis/cli, which carries praxis devops deploy, the OpenTofu orchestration and the built-in cloudflare and e.g. "latest" */ engine?:string;/** Which machine a promotion is built on. e.g. "spot" */ builder?:"slim"|"spot"};release?:{/** Which engine runs a promotion of this project. e.g. "queue" */ engine?:"queue"|"workflow"}};/** Free-form key and value pairs on the project, for grouping and for a caller's own bookkeeping; empty when none were set. e.g. {"team":"platform"} */ labels:{[key:string]:string}}>;请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json | The project’s name and where its code lives: a git package of our own Git, or a GitHub repository. |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | The created project with its repository binding, settings and labels. |
| 400 | application/json | INVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible. |
| 404 | application/json | CONNECTION_NOT_FOUND means no connection with that id exists in this organization, or it belongs to another organization; list the connections and use an id from that answer. A deleted connection is still readable until it is removed, so this answer means the id itself is unknown. |
| 409 | application/json | PROJECT_NAME_TAKEN means the name is used in this organization; REPOSITORY_ALREADY_BOUND means the package or repository already backs a project; DEFAULT_BRANCH_EXISTS means initialRef was given but the default branch already exists. Nothing was created. |
| 500 | application/json | INTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again. |