You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/product/command-spec.md
+75-1Lines changed: 75 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ The preview package includes these command groups:
11
11
12
12
-`auth`
13
13
-`project` (includes `project env` subgroup)
14
+
-`git`
14
15
-`branch`
15
16
-`app`
16
17
@@ -20,6 +21,9 @@ The preview package also includes one top-level utility command:
20
21
21
22
`version` is intentionally outside the workflow groups: it reports CLI build and environment state, requires no auth, no project context, and no network, and is the canonical answer to "is this CLI installed and on the build I expect?"
22
23
24
+
The Git repository connection slice uses the `git` group. It does not add a
25
+
provider-specific `GitHub` group.
26
+
23
27
Out of scope for the current preview:
24
28
25
29
-`init`
@@ -173,7 +177,7 @@ Rules:
173
177
-`cli.version` is the published package version.
174
178
-`node.version` mirrors `process.version` exactly, including the leading `v`.
175
179
-`os.platform` and `os.arch` mirror `process.platform` and `process.arch`.
176
-
-`invocation` is best-effort and may be `null` when no signal is conclusive.
180
+
-`invocation` is best-effort and falls back to `"unknown"` when no signal is conclusive.
177
181
178
182
Examples:
179
183
@@ -308,6 +312,76 @@ prisma-cli project show --json
308
312
prisma-cli project show --project proj_123 --json
309
313
```
310
314
315
+
## `prisma-cli git connect [git-url]`
316
+
317
+
Purpose:
318
+
319
+
- connect the resolved Prisma project to a GitHub repository
320
+
321
+
Behavior:
322
+
323
+
- requires auth
324
+
- resolves project context without creating projects
325
+
- supports `--project <id-or-name>` for explicit project selection
326
+
- if `[git-url]` is provided, parses it as a GitHub repository URL
327
+
- if `[git-url]` is omitted, reads the local Git `origin` remote URL
328
+
- accepts common GitHub URL forms such as:
329
+
-`https://github.com/prisma/prisma-cli`
330
+
-`https://github.com/prisma/prisma-cli.git`
331
+
-`git@github.com:prisma/prisma-cli.git`
332
+
- rejects unsupported providers with `REPO_PROVIDER_UNSUPPORTED`
333
+
- stores the repository connection server-side through the Management API
334
+
- does not write repository data to `prisma.config.ts`
335
+
- does not create branches synchronously
336
+
- when the connection is active, enables platform webhook automation to map GitHub branch activity to Prisma Branch state
337
+
338
+
Current backend contract:
339
+
340
+
- the CLI lists GitHub App installations for the authenticated workspace through the Management API
341
+
- if no installation exists, the CLI creates a GitHub App install intent and returns the install URL
342
+
- in interactive mode, the CLI attempts to open the install URL in the browser and waits for the installation to become available
343
+
- in non-interactive or `--json` mode, the CLI exits with `REPO_INSTALLATION_REQUIRED` and includes the install URL
344
+
- the CLI lists repositories visible to the installation and finds the matching `owner/repo`
345
+
- if the repository is not visible to any installation, the CLI creates a GitHub App install intent and exposes the install URL
346
+
- if the repository still is not visible after the installation or repository-access step, the command fails with `REPO_NOT_ACCESSIBLE`
347
+
- if the project is already connected to the same repository, the command returns the existing connection without creating a duplicate
348
+
- if the project is already connected to a different repository, the command fails with `REPO_ALREADY_CONNECTED`
349
+
- the CLI links the project to the repository with `POST /v1/source-repositories`
350
+
- the link call sends `projectId`, `provider: "github"`, `providerRepositoryId`, and `installationId`
0 commit comments