From 24526a3b2327362cfe2ffcd2f36bdb2034d9a05b Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Thu, 28 May 2026 18:40:48 +0700 Subject: [PATCH] Move branch-slug to @getpaseo/protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The app must not import @getpaseo/server. Moving the slug validation and slugify helpers into @getpaseo/protocol (already a shared dep of app, client, server) gives every package a legitimate home for the import. Drops the corresponding ./utils/branch-slug subpath from @getpaseo/server's exports map. Unblocks the Deploy App workflow, which only builds protocol/client/ audio for the app — server's dist never exists in that pipeline. --- .../app/src/components/sidebar-workspace-list.tsx | 2 +- .../utils => protocol/src}/branch-slug.test.ts | 15 --------------- .../src/utils => protocol/src}/branch-slug.ts | 0 packages/server/package.json | 5 ----- packages/server/src/server/session.ts | 2 +- packages/server/src/utils/worktree.ts | 4 ++-- 6 files changed, 4 insertions(+), 24 deletions(-) rename packages/{server/src/utils => protocol/src}/branch-slug.test.ts (75%) rename packages/{server/src/utils => protocol/src}/branch-slug.ts (100%) diff --git a/packages/app/src/components/sidebar-workspace-list.tsx b/packages/app/src/components/sidebar-workspace-list.tsx index 22fc777e4..bc8b2bbaa 100644 --- a/packages/app/src/components/sidebar-workspace-list.tsx +++ b/packages/app/src/components/sidebar-workspace-list.tsx @@ -13,7 +13,7 @@ import { } from "react-native"; import * as Haptics from "expo-haptics"; import { useMutation, useQueries, useQueryClient } from "@tanstack/react-query"; -import { slugify, validateBranchSlug, MAX_SLUG_LENGTH } from "@getpaseo/server/utils/branch-slug"; +import { slugify, validateBranchSlug, MAX_SLUG_LENGTH } from "@getpaseo/protocol/branch-slug"; import { AdaptiveRenameModal } from "@/components/rename-modal"; import { invalidateCheckoutGitQueriesForClient } from "@/git/query-keys"; import { diff --git a/packages/server/src/utils/branch-slug.test.ts b/packages/protocol/src/branch-slug.test.ts similarity index 75% rename from packages/server/src/utils/branch-slug.test.ts rename to packages/protocol/src/branch-slug.test.ts index 343bbd16b..2130149f0 100644 --- a/packages/server/src/utils/branch-slug.test.ts +++ b/packages/protocol/src/branch-slug.test.ts @@ -40,21 +40,6 @@ describe("branch slug utilities", () => { }); }); - it("is exported through the package subpath", () => { - const currentDir = dirname(fileURLToPath(import.meta.url)); - const packageJson = JSON.parse( - readFileSync(join(currentDir, "..", "..", "package.json"), "utf8"), - ) as { - exports?: Record; - }; - - expect(packageJson.exports?.["./utils/branch-slug"]).toEqual({ - types: "./dist/server/utils/branch-slug.d.ts", - source: "./src/utils/branch-slug.ts", - default: "./dist/server/utils/branch-slug.js", - }); - }); - it("does not import server-only modules", () => { const currentDir = dirname(fileURLToPath(import.meta.url)); const source = readFileSync(join(currentDir, "branch-slug.ts"), "utf8"); diff --git a/packages/server/src/utils/branch-slug.ts b/packages/protocol/src/branch-slug.ts similarity index 100% rename from packages/server/src/utils/branch-slug.ts rename to packages/protocol/src/branch-slug.ts diff --git a/packages/server/package.json b/packages/server/package.json index 63ede7667..cac4406be 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -22,11 +22,6 @@ "types": "./dist/server/utils/tool-call-parsers.d.ts", "source": "./src/utils/tool-call-parsers.ts", "default": "./dist/server/utils/tool-call-parsers.js" - }, - "./utils/branch-slug": { - "types": "./dist/server/utils/branch-slug.d.ts", - "source": "./src/utils/branch-slug.ts", - "default": "./dist/server/utils/branch-slug.js" } }, "publishConfig": { diff --git a/packages/server/src/server/session.ts b/packages/server/src/server/session.ts index cd7c42ec4..f030a23f8 100644 --- a/packages/server/src/server/session.ts +++ b/packages/server/src/server/session.ts @@ -199,7 +199,7 @@ import { createPullRequest, renameCurrentBranch, } from "../utils/checkout-git.js"; -import { validateBranchSlug } from "../utils/branch-slug.js"; +import { validateBranchSlug } from "@getpaseo/protocol/branch-slug"; import { getProjectIcon } from "../utils/project-icon.js"; import { expandTilde } from "../utils/path.js"; import { searchHomeDirectories, searchWorkspaceEntries } from "../utils/directory-suggestions.js"; diff --git a/packages/server/src/utils/worktree.ts b/packages/server/src/utils/worktree.ts index 418d25879..eb2b49c87 100644 --- a/packages/server/src/utils/worktree.ts +++ b/packages/server/src/utils/worktree.ts @@ -30,9 +30,9 @@ import { spawnProcess } from "./spawn.js"; import { resolvePaseoHome } from "../server/paseo-home.js"; import { createExternalProcessEnv } from "../server/paseo-env.js"; import { parseGitRevParsePath, resolveGitRevParsePath } from "./git-rev-parse-path.js"; -import { validateBranchSlug } from "./branch-slug.js"; +import { validateBranchSlug } from "@getpaseo/protocol/branch-slug"; -export { slugify, validateBranchSlug } from "./branch-slug.js"; +export { slugify, validateBranchSlug } from "@getpaseo/protocol/branch-slug"; const execFileAsync = promisify(execFile); const READ_ONLY_GIT_ENV = {