Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .cursor/commands/gt-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Git Workflow with Graphite

## Overview

Use Graphite (`gt`) instead of git for ALL branch and commit operations in this repository.

## Forbidden Git Commands

NEVER use these git commands directly:

- `git push` → use `gt submit --no-edit`
- `git branch` → use `gt create`

## Graphite Commands

| Command | Description |
| -------------------------------------- | ------------------------------------------- |
| `gt create <branch-name> -m "message"` | Create a new branch with commit |
| `gt modify -a --no-edit` | Stage all and amend current branch's commit |
| `gt checkout <branch>` | Switch branches |
| `gt sync` | Sync and restack all branches |
| `gt submit --no-edit` | Push and create/update PRs |
| `gt log short` | View stack status |

## Creating PRs with Descriptions

All PRs require a description. Use this workflow:

```bash
gt submit --no-edit
gh pr edit <pr-number> --body "Place description here"
```

## Safety Rules

- Graphite force-pushes everything - old commits only recoverable via reflog
- Never have uncommitted changes when switching branches - they get lost during restack
- Never use `git stash` with Graphite - causes conflicts when `gt modify` restacks
- Never use `git checkout HEAD -- <file>` after editing - silently restores unfixed version
- Always use `gt checkout` (not `git checkout`) to switch branches
- `gt modify --no-edit` with unstaged/untracked files stages ALL changes
- `gt sync` pulls FROM remote, doesn't push TO remote
- `gt modify` restacks children locally but doesn't push them
- Always verify with `git status -sb` after stack operations

## Safe Multi-Branch Fix Workflow

```bash
gt checkout parent-branch
# make edits
gt modify -a --no-edit # Stage all, amend, restack children
git show HEAD -- <files> # VERIFY fix is in commit
gt submit --no-edit # Push immediately

gt checkout child-branch # Already restacked from gt modify
# make edits
gt modify -a --no-edit
git show HEAD -- <files> # VERIFY
gt submit --no-edit
```

## Checklist

- [ ] Using `gt` commands instead of `git push`/`git branch`
- [ ] No uncommitted changes before switching branches
- [ ] Verified changes with `git status -sb` after stack operations
- [ ] PR description follows `.github/pull_request_template.md` format
264 changes: 264 additions & 0 deletions docs/01-app/glossary.mdx

Large diffs are not rendered by default.

71 changes: 0 additions & 71 deletions errors/deploymentid-invalid-characters.mdx

This file was deleted.

34 changes: 0 additions & 34 deletions errors/deploymentid-not-a-string.mdx

This file was deleted.

51 changes: 0 additions & 51 deletions errors/deploymentid-too-long.mdx

This file was deleted.

6 changes: 1 addition & 5 deletions packages/next/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -980,9 +980,5 @@
"979": "invariant: expected %s bytes of postponed state but only received %s bytes",
"980": "Failed to load client middleware manifest",
"981": "resolvedPathname must be set in request metadata",
"982": "`serializeResumeDataCache` should not be called in edge runtime.",
"983": "deploymentId function must return a string. https://nextjs.org/docs/messages/deploymentid-not-a-string",
"984": "The deploymentId \"%s\" cannot start with the \"dpl_\" prefix. Please choose a different deploymentId in your next.config.js. https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id",
"985": "The deploymentId \"%s\" exceeds the maximum length of 32 characters. Please choose a shorter deploymentId. https://nextjs.org/docs/messages/deploymentid-too-long",
"986": "The deploymentId \"%s\" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed. https://nextjs.org/docs/messages/deploymentid-invalid-characters"
"982": "`serializeResumeDataCache` should not be called in edge runtime."
}
8 changes: 0 additions & 8 deletions packages/next/src/build/adapter/build-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ export interface NextAdapter {
* influenced by NextConfig.generateBuildId
*/
buildId: string
/**
* deploymentId is the current deployment ID, this can be
* influenced by NextConfig.deploymentId or NEXT_DEPLOYMENT_ID environment variable
*/
deploymentId: string
}) => Promise<void> | void
}

Expand Down Expand Up @@ -420,7 +415,6 @@ export async function handleBuildComplete({
config,
appType,
buildId,
deploymentId,
configOutDir,
distDir,
pageKeys,
Expand All @@ -444,7 +438,6 @@ export async function handleBuildComplete({
appType: 'app' | 'pages' | 'hybrid'
distDir: string
buildId: string
deploymentId: string
configOutDir: string
adapterPath: string
tracingRoot: string
Expand Down Expand Up @@ -1863,7 +1856,6 @@ export async function handleBuildComplete({
config,
distDir,
buildId,
deploymentId,
nextVersion,
projectDir: dir,
repoRoot: tracingRoot,
Expand Down
6 changes: 1 addition & 5 deletions packages/next/src/build/analyze/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import loadCustomRoutes from '../../lib/load-custom-routes'
import { generateRoutesManifest } from '../generate-routes-manifest'
import { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr'
import { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'
import { resolveAndSetDeploymentId } from '../generate-deployment-id'
import http from 'node:http'

// @ts-expect-error types are in @types/serve-handler
Expand Down Expand Up @@ -54,10 +53,7 @@ export default async function analyze({
reactProductionProfiling,
})

config.deploymentId = resolveAndSetDeploymentId(
config.deploymentId,
config.deploymentId != null ? 'user-config' : 'env-var'
)
process.env.NEXT_DEPLOYMENT_ID = config.deploymentId || ''

const distDir = path.join(dir, '.next')
const telemetry = new Telemetry({ distDir })
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/build/build-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export interface MappedPages {
// to pass it through function arguments.
// Not exhaustive, but should be extended to as needed whilst refactoring
export const NextBuildContext: Partial<{
deploymentId?: string | undefined
compilerIdx?: number
pluginState: Record<string, any>
// core fields
Expand Down Expand Up @@ -97,7 +96,6 @@ export const NextBuildContext: Partial<{
isCompileMode?: boolean
debugPrerender: boolean
analyze: boolean
preservedDeploymentId?: string
debugBuildPaths?: {
app: string[]
pages: string[]
Expand Down
4 changes: 1 addition & 3 deletions packages/next/src/build/define-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const DEFINE_ENV_EXPRESSION = Symbol('DEFINE_ENV_EXPRESSION')
interface DefineEnv {
[key: string]:
| string
| (() => string)
| string[]
| boolean
| { [DEFINE_ENV_EXPRESSION]: string }
Expand Down Expand Up @@ -171,8 +170,7 @@ export function getDefineEnv({
'process.env.__NEXT_CACHE_COMPONENTS': isCacheComponentsEnabled,
'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,

...(config.experimental?.useSkewCookie ||
(!config.deploymentId && !config.experimental?.runtimeServerDeploymentId)
...(config.experimental?.useSkewCookie || !config.deploymentId
? {
'process.env.NEXT_DEPLOYMENT_ID': false,
}
Expand Down
Loading
Loading