Move branch-slug to @getpaseo/protocol

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.
This commit is contained in:
Mohamed Boudra
2026-05-28 18:41:13 +07:00
parent 6d1aa1f415
commit 24526a3b23
6 changed files with 4 additions and 24 deletions
@@ -13,7 +13,7 @@ import {
} from "react-native"; } from "react-native";
import * as Haptics from "expo-haptics"; import * as Haptics from "expo-haptics";
import { useMutation, useQueries, useQueryClient } from "@tanstack/react-query"; 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 { AdaptiveRenameModal } from "@/components/rename-modal";
import { invalidateCheckoutGitQueriesForClient } from "@/git/query-keys"; import { invalidateCheckoutGitQueriesForClient } from "@/git/query-keys";
import { import {
@@ -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<string, { types?: string; source?: string; default?: string }>;
};
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", () => { it("does not import server-only modules", () => {
const currentDir = dirname(fileURLToPath(import.meta.url)); const currentDir = dirname(fileURLToPath(import.meta.url));
const source = readFileSync(join(currentDir, "branch-slug.ts"), "utf8"); const source = readFileSync(join(currentDir, "branch-slug.ts"), "utf8");
-5
View File
@@ -22,11 +22,6 @@
"types": "./dist/server/utils/tool-call-parsers.d.ts", "types": "./dist/server/utils/tool-call-parsers.d.ts",
"source": "./src/utils/tool-call-parsers.ts", "source": "./src/utils/tool-call-parsers.ts",
"default": "./dist/server/utils/tool-call-parsers.js" "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": { "publishConfig": {
+1 -1
View File
@@ -199,7 +199,7 @@ import {
createPullRequest, createPullRequest,
renameCurrentBranch, renameCurrentBranch,
} from "../utils/checkout-git.js"; } 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 { getProjectIcon } from "../utils/project-icon.js";
import { expandTilde } from "../utils/path.js"; import { expandTilde } from "../utils/path.js";
import { searchHomeDirectories, searchWorkspaceEntries } from "../utils/directory-suggestions.js"; import { searchHomeDirectories, searchWorkspaceEntries } from "../utils/directory-suggestions.js";
+2 -2
View File
@@ -30,9 +30,9 @@ import { spawnProcess } from "./spawn.js";
import { resolvePaseoHome } from "../server/paseo-home.js"; import { resolvePaseoHome } from "../server/paseo-home.js";
import { createExternalProcessEnv } from "../server/paseo-env.js"; import { createExternalProcessEnv } from "../server/paseo-env.js";
import { parseGitRevParsePath, resolveGitRevParsePath } from "./git-rev-parse-path.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 execFileAsync = promisify(execFile);
const READ_ONLY_GIT_ENV = { const READ_ONLY_GIT_ENV = {