Showing the changes to apps/server/src/git (2 of 71 files). Show all
Unified · Split
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // @effect-diagnostics nodeBuiltinImport:off |
| 2 | −import fs from "node:fs"; | |
| 3 | −import path from "node:path"; | |
| 4 | −import { spawnSync } from "node:child_process"; | |
| 2 | +import * as NodeFS from "node:fs"; | |
| 3 | +import * as NodePath from "node:path"; | |
| 4 | +import * as NodeChildProcess from "node:child_process"; | |
| 5 | 5 | |
| 6 | 6 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
| 7 | 7 | import { it } from "@effect/vitest"; |
| @@ -164,7 +164,7 @@ function normalizeFakePullRequestSummary(raw: unknown): GitHubCli.GitHubPullRequ · 156 unmodified lines | ||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | function runGitSyncForFakeGh(cwd: string, args: readonly string[]): void { |
| 167 | − const result = spawnSync("git", args, { | |
| 167 | + const result = NodeChildProcess.spawnSync("git", args, { | |
| 168 | 168 | cwd, |
| 169 | 169 | encoding: "utf8", |
| 170 | 170 | }); |
| @@ -254,7 +254,7 @@ function initRepo( · 83 unmodified lines | ||
| 254 | 254 | yield* runGit(cwd, ["init", "--initial-branch=main"]); |
| 255 | 255 | yield* runGit(cwd, ["config", "user.email", "test@example.com"]); |
| 256 | 256 | yield* runGit(cwd, ["config", "user.name", "Test User"]); |
| 257 | − yield* fs.writeFileString(path.join(cwd, "README.md"), "hello\n"); | |
| 257 | + yield* fs.writeFileString(NodePath.join(cwd, "README.md"), "hello\n"); | |
| 258 | 258 | yield* runGit(cwd, ["add", "README.md"]); |
| 259 | 259 | yield* runGit(cwd, ["commit", "-m", "Initial commit"]); |
| 260 | 260 | }); |
| @@ -459,7 +459,7 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): { · 198 unmodified lines | ||
| 459 | 459 | try: () => { |
| 460 | 460 | const headBranch = scenario.pullRequest?.headRefName; |
| 461 | 461 | if (headBranch) { |
| 462 | − const existingBranch = spawnSync( | |
| 462 | + const existingBranch = NodeChildProcess.spawnSync( | |
| 463 | 463 | "git", |
| 464 | 464 | ["show-ref", "--verify", "--quiet", `refs/heads/${headBranch}`], |
| 465 | 465 | { |
| @@ -916,7 +916,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 450 unmodified lines | ||
| 916 | 916 | it.effect("status returns an explicit non-repo result for deleted directories", () => |
| 917 | 917 | Effect.gen(function* () { |
| 918 | 918 | const rootDir = yield* makeTempDir("t3code-git-manager-missing-dir-"); |
| 919 | − const cwd = path.join(rootDir, "deleted-repo"); | |
| 919 | + const cwd = NodePath.join(rootDir, "deleted-repo"); | |
| 920 | 920 | yield* makeDirectory(cwd); |
| 921 | 921 | yield* removePath(cwd); |
| 922 | 922 | const { manager } = yield* makeManager(); |
| @@ -1026,7 +1026,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 103 unmodified lines | ||
| 1026 | 1026 | const forkDir = yield* createBareRemote(); |
| 1027 | 1027 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 1028 | 1028 | yield* runGit(repoDir, ["checkout", "-b", "statemachine"]); |
| 1029 | − fs.writeFileSync(path.join(repoDir, "fork-pr.txt"), "fork pr\n"); | |
| 1029 | + NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n"); | |
| 1030 | 1030 | yield* runGit(repoDir, ["add", "fork-pr.txt"]); |
| 1031 | 1031 | yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]); |
| 1032 | 1032 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| @@ -1348,7 +1348,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 315 unmodified lines | ||
| 1348 | 1348 | Effect.gen(function* () { |
| 1349 | 1349 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 1350 | 1350 | yield* initRepo(repoDir); |
| 1351 | − fs.writeFileSync(path.join(repoDir, "README.md"), "hello\nworld\n"); | |
| 1351 | + NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello\nworld\n"); | |
| 1352 | 1352 | |
| 1353 | 1353 | const { manager } = yield* makeManager(); |
| 1354 | 1354 | const result = yield* runStackedAction(manager, { |
| @@ -1383,7 +1383,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 28 unmodified lines | ||
| 1383 | 1383 | Effect.gen(function* () { |
| 1384 | 1384 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 1385 | 1385 | yield* initRepo(repoDir); |
| 1386 | − fs.writeFileSync(path.join(repoDir, "README.md"), "hello\ncustom\n"); | |
| 1386 | + NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello\ncustom\n"); | |
| 1387 | 1387 | let generatedCount = 0; |
| 1388 | 1388 | |
| 1389 | 1389 | const { manager } = yield* makeManager({ |
| @@ -1426,8 +1426,8 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 36 unmodified lines | ||
| 1426 | 1426 | Effect.gen(function* () { |
| 1427 | 1427 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 1428 | 1428 | yield* initRepo(repoDir); |
| 1429 | − fs.writeFileSync(path.join(repoDir, "a.txt"), "file a\n"); | |
| 1430 | − fs.writeFileSync(path.join(repoDir, "b.txt"), "file b\n"); | |
| 1429 | + NodeFS.writeFileSync(NodePath.join(repoDir, "a.txt"), "file a\n"); | |
| 1430 | + NodeFS.writeFileSync(NodePath.join(repoDir, "b.txt"), "file b\n"); | |
| 1431 | 1431 | |
| 1432 | 1432 | const { manager } = yield* makeManager(); |
| 1433 | 1433 | const result = yield* runStackedAction(manager, { |
| @@ -1454,7 +1454,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 20 unmodified lines | ||
| 1454 | 1454 | const remoteDir = yield* createBareRemote(); |
| 1455 | 1455 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1456 | 1456 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 1457 | − fs.writeFileSync(path.join(repoDir, "README.md"), "hello\nfeature-branch\n"); | |
| 1457 | + NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello\nfeature-branch\n"); | |
| 1458 | 1458 | let generatedCount = 0; |
| 1459 | 1459 | |
| 1460 | 1460 | const { manager } = yield* makeManager({ |
| @@ -1514,7 +1514,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 53 unmodified lines | ||
| 1514 | 1514 | Effect.gen(function* () { |
| 1515 | 1515 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 1516 | 1516 | yield* initRepo(repoDir); |
| 1517 | − fs.writeFileSync(path.join(repoDir, "README.md"), "hello\ncustom-feature\n"); | |
| 1517 | + NodeFS.writeFileSync(NodePath.join(repoDir, "README.md"), "hello\ncustom-feature\n"); | |
| 1518 | 1518 | let generatedCount = 0; |
| 1519 | 1519 | |
| 1520 | 1520 | const { manager } = yield* makeManager({ |
| @@ -1597,7 +1597,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 76 unmodified lines | ||
| 1597 | 1597 | yield* runGit(repoDir, ["checkout", "-b", "feature/stacked-flow"]); |
| 1598 | 1598 | const remoteDir = yield* createBareRemote(); |
| 1599 | 1599 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1600 | − fs.writeFileSync(path.join(repoDir, "feature.txt"), "feature\n"); | |
| 1600 | + NodeFS.writeFileSync(NodePath.join(repoDir, "feature.txt"), "feature\n"); | |
| 1601 | 1601 | |
| 1602 | 1602 | const { manager } = yield* makeManager(); |
| 1603 | 1603 | const result = yield* runStackedAction(manager, { |
| @@ -1626,7 +1626,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 22 unmodified lines | ||
| 1626 | 1626 | yield* runGit(repoDir, ["checkout", "-b", "feature/no-upstream-pr"]); |
| 1627 | 1627 | const remoteDir = yield* createBareRemote(); |
| 1628 | 1628 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1629 | − fs.writeFileSync(path.join(repoDir, "feature.txt"), "feature\n"); | |
| 1629 | + NodeFS.writeFileSync(NodePath.join(repoDir, "feature.txt"), "feature\n"); | |
| 1630 | 1630 | |
| 1631 | 1631 | const { manager, ghCalls } = yield* makeManager({ |
| 1632 | 1632 | ghScenario: { |
| @@ -1697,7 +1697,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 64 unmodified lines | ||
| 1697 | 1697 | yield* runGit(repoDir, ["checkout", "-b", "feature/push-only"]); |
| 1698 | 1698 | const remoteDir = yield* createBareRemote(); |
| 1699 | 1699 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1700 | − fs.writeFileSync(path.join(repoDir, "push-only.txt"), "push only\n"); | |
| 1700 | + NodeFS.writeFileSync(NodePath.join(repoDir, "push-only.txt"), "push only\n"); | |
| 1701 | 1701 | yield* runGit(repoDir, ["add", "push-only.txt"]); |
| 1702 | 1702 | yield* runGit(repoDir, ["commit", "-m", "Push only branch"]); |
| 1703 | 1703 | |
| @@ -1725,11 +1725,11 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 21 unmodified lines | ||
| 1725 | 1725 | yield* runGit(repoDir, ["checkout", "-b", "feature/push-dirty"]); |
| 1726 | 1726 | const remoteDir = yield* createBareRemote(); |
| 1727 | 1727 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1728 | − fs.writeFileSync(path.join(repoDir, "push-dirty.txt"), "push dirty\n"); | |
| 1728 | + NodeFS.writeFileSync(NodePath.join(repoDir, "push-dirty.txt"), "push dirty\n"); | |
| 1729 | 1729 | yield* runGit(repoDir, ["add", "push-dirty.txt"]); |
| 1730 | 1730 | yield* runGit(repoDir, ["commit", "-m", "Push dirty branch"]); |
| 1731 | − fs.mkdirSync(path.join(repoDir, ".vercel")); | |
| 1732 | − fs.writeFileSync(path.join(repoDir, ".vercel", "project.json"), "{}\n"); | |
| 1731 | + NodeFS.mkdirSync(NodePath.join(repoDir, ".vercel")); | |
| 1732 | + NodeFS.writeFileSync(NodePath.join(repoDir, ".vercel", "project.json"), "{}\n"); | |
| 1733 | 1733 | |
| 1734 | 1734 | const { manager } = yield* makeManager(); |
| 1735 | 1735 | const result = yield* runStackedAction(manager, { |
| @@ -1760,7 +1760,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 24 unmodified lines | ||
| 1760 | 1760 | yield* runGit(repoDir, ["checkout", "-b", "feature/create-pr-only"]); |
| 1761 | 1761 | const remoteDir = yield* createBareRemote(); |
| 1762 | 1762 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 1763 | − fs.writeFileSync(path.join(repoDir, "create-pr-only.txt"), "create pr\n"); | |
| 1763 | + NodeFS.writeFileSync(NodePath.join(repoDir, "create-pr-only.txt"), "create pr\n"); | |
| 1764 | 1764 | yield* runGit(repoDir, ["add", "create-pr-only.txt"]); |
| 1765 | 1765 | yield* runGit(repoDir, ["commit", "-m", "Create PR only branch"]); |
| 1766 | 1766 | |
| @@ -1805,7 +1805,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 38 unmodified lines | ||
| 1805 | 1805 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 1806 | 1806 | yield* initRepo(repoDir); |
| 1807 | 1807 | yield* runGit(repoDir, ["checkout", "-b", "feature/provider-fallback"]); |
| 1808 | − fs.writeFileSync(path.join(repoDir, "provider-fallback.txt"), "fallback\n"); | |
| 1808 | + NodeFS.writeFileSync(NodePath.join(repoDir, "provider-fallback.txt"), "fallback\n"); | |
| 1809 | 1809 | yield* runGit(repoDir, ["add", "provider-fallback.txt"]); |
| 1810 | 1810 | yield* runGit(repoDir, ["commit", "-m", "Provider fallback"]); |
| 1811 | 1811 | const remoteDir = yield* createBareRemote(); |
| @@ -1982,7 +1982,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 170 unmodified lines | ||
| 1982 | 1982 | yield* runGit(repoDir, ["checkout", "main"]); |
| 1983 | 1983 | yield* runGit(repoDir, ["branch", "-D", "effect-atom"]); |
| 1984 | 1984 | yield* runGit(repoDir, ["checkout", "--track", "my-org/upstream/effect-atom"]); |
| 1985 | − fs.writeFileSync(path.join(repoDir, "changes.txt"), "change\n"); | |
| 1985 | + NodeFS.writeFileSync(NodePath.join(repoDir, "changes.txt"), "change\n"); | |
| 1986 | 1986 | yield* runGit(repoDir, ["add", "changes.txt"]); |
| 1987 | 1987 | yield* runGit(repoDir, ["commit", "-m", "Feature commit"]); |
| 1988 | 1988 | |
| @@ -2200,7 +2200,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 211 unmodified lines | ||
| 2200 | 2200 | yield* runGit(repoDir, ["checkout", "-b", "feature-create-pr"]); |
| 2201 | 2201 | const remoteDir = yield* createBareRemote(); |
| 2202 | 2202 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2203 | − fs.writeFileSync(path.join(repoDir, "changes.txt"), "change\n"); | |
| 2203 | + NodeFS.writeFileSync(NodePath.join(repoDir, "changes.txt"), "change\n"); | |
| 2204 | 2204 | yield* runGit(repoDir, ["add", "changes.txt"]); |
| 2205 | 2205 | yield* runGit(repoDir, ["commit", "-m", "Feature commit"]); |
| 2206 | 2206 | yield* runGit(repoDir, ["push", "-u", "origin", "feature-create-pr"]); |
| @@ -2252,7 +2252,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 45 unmodified lines | ||
| 2252 | 2252 | yield* runGit(peerDir, ["clone", remoteDir, "."]); |
| 2253 | 2253 | yield* runGit(peerDir, ["config", "user.email", "peer@example.com"]); |
| 2254 | 2254 | yield* runGit(peerDir, ["config", "user.name", "Peer User"]); |
| 2255 | − fs.writeFileSync(path.join(peerDir, "remote.txt"), "remote\n"); | |
| 2255 | + NodeFS.writeFileSync(NodePath.join(peerDir, "remote.txt"), "remote\n"); | |
| 2256 | 2256 | yield* runGit(peerDir, ["add", "remote.txt"]); |
| 2257 | 2257 | yield* runGit(peerDir, ["commit", "-m", "Remote base commit"]); |
| 2258 | 2258 | yield* runGit(peerDir, ["push", "origin", "main"]); |
| @@ -2265,7 +2265,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 6 unmodified lines | ||
| 2265 | 2265 | "feature/remote-base", |
| 2266 | 2266 | "origin/main", |
| 2267 | 2267 | ]); |
| 2268 | − fs.writeFileSync(path.join(repoDir, "feature.txt"), "feature\n"); | |
| 2268 | + NodeFS.writeFileSync(NodePath.join(repoDir, "feature.txt"), "feature\n"); | |
| 2269 | 2269 | yield* runGit(repoDir, ["add", "feature.txt"]); |
| 2270 | 2270 | yield* runGit(repoDir, ["commit", "-m", "Feature commit"]); |
| 2271 | 2271 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/remote-base"]); |
| @@ -2304,7 +2304,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 32 unmodified lines | ||
| 2304 | 2304 | yield* runGit(repoDir, ["checkout", "-b", "feature/no-fork-match"]); |
| 2305 | 2305 | const remoteDir = yield* createBareRemote(); |
| 2306 | 2306 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2307 | − fs.writeFileSync(path.join(repoDir, "changes.txt"), "change\n"); | |
| 2307 | + NodeFS.writeFileSync(NodePath.join(repoDir, "changes.txt"), "change\n"); | |
| 2308 | 2308 | yield* runGit(repoDir, ["add", "changes.txt"]); |
| 2309 | 2309 | yield* runGit(repoDir, ["commit", "-m", "Feature commit"]); |
| 2310 | 2310 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/no-fork-match"]); |
| @@ -2376,7 +2376,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 65 unmodified lines | ||
| 2376 | 2376 | const forkDir = yield* createBareRemote(); |
| 2377 | 2377 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 2378 | 2378 | yield* runGit(repoDir, ["checkout", "-b", "statemachine"]); |
| 2379 | − fs.writeFileSync(path.join(repoDir, "changes.txt"), "change\n"); | |
| 2379 | + NodeFS.writeFileSync(NodePath.join(repoDir, "changes.txt"), "change\n"); | |
| 2380 | 2380 | yield* runGit(repoDir, ["add", "changes.txt"]); |
| 2381 | 2381 | yield* runGit(repoDir, ["commit", "-m", "Feature commit"]); |
| 2382 | 2382 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| @@ -2556,7 +2556,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 173 unmodified lines | ||
| 2556 | 2556 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 2557 | 2557 | yield* initRepo(repoDir); |
| 2558 | 2558 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-local"]); |
| 2559 | − fs.writeFileSync(path.join(repoDir, "local.txt"), "local\n"); | |
| 2559 | + NodeFS.writeFileSync(NodePath.join(repoDir, "local.txt"), "local\n"); | |
| 2560 | 2560 | yield* runGit(repoDir, ["add", "local.txt"]); |
| 2561 | 2561 | yield* runGit(repoDir, ["commit", "-m", "Local PR branch"]); |
| 2562 | 2562 | |
| @@ -2597,7 +2597,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 34 unmodified lines | ||
| 2597 | 2597 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2598 | 2598 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2599 | 2599 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-local-upstream"]); |
| 2600 | − fs.writeFileSync(path.join(repoDir, "upstream.txt"), "upstream\n"); | |
| 2600 | + NodeFS.writeFileSync(NodePath.join(repoDir, "upstream.txt"), "upstream\n"); | |
| 2601 | 2601 | yield* runGit(repoDir, ["add", "upstream.txt"]); |
| 2602 | 2602 | yield* runGit(repoDir, ["commit", "-m", "Local upstream PR branch"]); |
| 2603 | 2603 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-local-upstream"]); |
| @@ -2655,7 +2655,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 51 unmodified lines | ||
| 2655 | 2655 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2656 | 2656 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2657 | 2657 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-local-no-head-repo"]); |
| 2658 | − fs.writeFileSync(path.join(repoDir, "no-head-repo.txt"), "upstream\n"); | |
| 2658 | + NodeFS.writeFileSync(NodePath.join(repoDir, "no-head-repo.txt"), "upstream\n"); | |
| 2659 | 2659 | yield* runGit(repoDir, ["add", "no-head-repo.txt"]); |
| 2660 | 2660 | yield* runGit(repoDir, ["commit", "-m", "Local PR branch without repo metadata"]); |
| 2661 | 2661 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-local-no-head-repo"]); |
| @@ -2702,7 +2702,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 40 unmodified lines | ||
| 2702 | 2702 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2703 | 2703 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2704 | 2704 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-worktree"]); |
| 2705 | − fs.writeFileSync(path.join(repoDir, "worktree.txt"), "worktree\n"); | |
| 2705 | + NodeFS.writeFileSync(NodePath.join(repoDir, "worktree.txt"), "worktree\n"); | |
| 2706 | 2706 | yield* runGit(repoDir, ["add", "worktree.txt"]); |
| 2707 | 2707 | yield* runGit(repoDir, ["commit", "-m", "PR worktree branch"]); |
| 2708 | 2708 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-worktree"]); |
| @@ -2730,7 +2730,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 21 unmodified lines | ||
| 2730 | 2730 | |
| 2731 | 2731 | expect(result.branch).toBe("feature/pr-worktree"); |
| 2732 | 2732 | expect(result.worktreePath).not.toBeNull(); |
| 2733 | − expect(fs.existsSync(result.worktreePath as string)).toBe(true); | |
| 2733 | + expect(NodeFS.existsSync(result.worktreePath as string)).toBe(true); | |
| 2734 | 2734 | const worktreeBranch = (yield* runGit(result.worktreePath as string, [ |
| 2735 | 2735 | "branch", |
| 2736 | 2736 | "--show-current", |
| @@ -2747,7 +2747,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 10 unmodified lines | ||
| 2747 | 2747 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 2748 | 2748 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2749 | 2749 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-worktree-setup"]); |
| 2750 | − fs.writeFileSync(path.join(repoDir, "setup.txt"), "setup\n"); | |
| 2750 | + NodeFS.writeFileSync(NodePath.join(repoDir, "setup.txt"), "setup\n"); | |
| 2751 | 2751 | yield* runGit(repoDir, ["add", "setup.txt"]); |
| 2752 | 2752 | yield* runGit(repoDir, ["commit", "-m", "PR worktree setup branch"]); |
| 2753 | 2753 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-worktree-setup"]); |
| @@ -2802,7 +2802,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 48 unmodified lines | ||
| 2802 | 2802 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2803 | 2803 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 2804 | 2804 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-fork"]); |
| 2805 | − fs.writeFileSync(path.join(repoDir, "fork.txt"), "fork\n"); | |
| 2805 | + NodeFS.writeFileSync(NodePath.join(repoDir, "fork.txt"), "fork\n"); | |
| 2806 | 2806 | yield* runGit(repoDir, ["add", "fork.txt"]); |
| 2807 | 2807 | yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]); |
| 2808 | 2808 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "feature/pr-fork"]); |
| @@ -2864,7 +2864,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 55 unmodified lines | ||
| 2864 | 2864 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2865 | 2865 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 2866 | 2866 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-local-fork"]); |
| 2867 | − fs.writeFileSync(path.join(repoDir, "local-fork.txt"), "local fork\n"); | |
| 2867 | + NodeFS.writeFileSync(NodePath.join(repoDir, "local-fork.txt"), "local fork\n"); | |
| 2868 | 2868 | yield* runGit(repoDir, ["add", "local-fork.txt"]); |
| 2869 | 2869 | yield* runGit(repoDir, ["commit", "-m", "Local fork PR branch"]); |
| 2870 | 2870 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "feature/pr-local-fork"]); |
| @@ -2917,7 +2917,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 46 unmodified lines | ||
| 2917 | 2917 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 2918 | 2918 | yield* runGit(repoDir, ["remote", "add", "binbandit-seed", forkDir]); |
| 2919 | 2919 | yield* runGit(repoDir, ["checkout", "-b", "fix/git-action-default-without-origin"]); |
| 2920 | − fs.writeFileSync(path.join(repoDir, "derived-fork.txt"), "derived fork\n"); | |
| 2920 | + NodeFS.writeFileSync(NodePath.join(repoDir, "derived-fork.txt"), "derived fork\n"); | |
| 2921 | 2921 | yield* runGit(repoDir, ["add", "derived-fork.txt"]); |
| 2922 | 2922 | yield* runGit(repoDir, ["commit", "-m", "Derived fork PR branch"]); |
| 2923 | 2923 | yield* runGit(repoDir, [ |
| @@ -2969,11 +2969,15 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 45 unmodified lines | ||
| 2969 | 2969 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 2970 | 2970 | yield* initRepo(repoDir); |
| 2971 | 2971 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-existing-worktree"]); |
| 2972 | − fs.writeFileSync(path.join(repoDir, "existing.txt"), "existing\n"); | |
| 2972 | + NodeFS.writeFileSync(NodePath.join(repoDir, "existing.txt"), "existing\n"); | |
| 2973 | 2973 | yield* runGit(repoDir, ["add", "existing.txt"]); |
| 2974 | 2974 | yield* runGit(repoDir, ["commit", "-m", "Existing worktree branch"]); |
| 2975 | 2975 | yield* runGit(repoDir, ["checkout", "main"]); |
| 2976 | − const worktreePath = path.join(repoDir, "..", `pr-existing-${path.basename(repoDir)}`); | |
| 2976 | + const worktreePath = NodePath.join( | |
| 2977 | + repoDir, | |
| 2978 | + "..", | |
| 2979 | + `pr-existing-${NodePath.basename(repoDir)}`, | |
| 2980 | + ); | |
| 2977 | 2981 | yield* runGit(repoDir, ["worktree", "add", worktreePath, "feature/pr-existing-worktree"]); |
| 2978 | 2982 | |
| 2979 | 2983 | const setupCalls: ProjectSetupScriptRunner.ProjectSetupScriptRunnerInput[] = []; |
| @@ -3004,8 +3008,8 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 24 unmodified lines | ||
| 3004 | 3008 | threadId: asThreadId("thread-pr-existing-worktree"), |
| 3005 | 3009 | }); |
| 3006 | 3010 | |
| 3007 | − expect(result.worktreePath && fs.realpathSync.native(result.worktreePath)).toBe( | |
| 3008 | − fs.realpathSync.native(worktreePath), | |
| 3011 | + expect(result.worktreePath && NodeFS.realpathSync.native(result.worktreePath)).toBe( | |
| 3012 | + NodeFS.realpathSync.native(worktreePath), | |
| 3009 | 3013 | ); |
| 3010 | 3014 | expect(result.branch).toBe("feature/pr-existing-worktree"); |
| 3011 | 3015 | expect(setupCalls).toHaveLength(0); |
| @@ -3024,7 +3028,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 12 unmodified lines | ||
| 3024 | 3028 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 3025 | 3029 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 3026 | 3030 | yield* runGit(repoDir, ["checkout", "-b", "fork-main-source"]); |
| 3027 | − fs.writeFileSync(path.join(repoDir, "fork-main.txt"), "fork main\n"); | |
| 3031 | + NodeFS.writeFileSync(NodePath.join(repoDir, "fork-main.txt"), "fork main\n"); | |
| 3028 | 3032 | yield* runGit(repoDir, ["add", "fork-main.txt"]); |
| 3029 | 3033 | yield* runGit(repoDir, ["commit", "-m", "Fork main branch"]); |
| 3030 | 3034 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "fork-main-source:main"]); |
| @@ -3084,7 +3088,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 53 unmodified lines | ||
| 3084 | 3088 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 3085 | 3089 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 3086 | 3090 | yield* runGit(repoDir, ["checkout", "-b", "fork-main-source"]); |
| 3087 | − fs.writeFileSync(path.join(repoDir, "fork-main-second.txt"), "fork main second\n"); | |
| 3091 | + NodeFS.writeFileSync(NodePath.join(repoDir, "fork-main-second.txt"), "fork main second\n"); | |
| 3088 | 3092 | yield* runGit(repoDir, ["add", "fork-main-second.txt"]); |
| 3089 | 3093 | yield* runGit(repoDir, ["commit", "-m", "Fork main second branch"]); |
| 3090 | 3094 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "fork-main-source:main"]); |
| @@ -3142,12 +3146,16 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 51 unmodified lines | ||
| 3142 | 3146 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 3143 | 3147 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 3144 | 3148 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-reused-fork"]); |
| 3145 | − fs.writeFileSync(path.join(repoDir, "reused-fork.txt"), "reused fork\n"); | |
| 3149 | + NodeFS.writeFileSync(NodePath.join(repoDir, "reused-fork.txt"), "reused fork\n"); | |
| 3146 | 3150 | yield* runGit(repoDir, ["add", "reused-fork.txt"]); |
| 3147 | 3151 | yield* runGit(repoDir, ["commit", "-m", "Reused fork PR branch"]); |
| 3148 | 3152 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "feature/pr-reused-fork"]); |
| 3149 | 3153 | yield* runGit(repoDir, ["checkout", "main"]); |
| 3150 | − const worktreePath = path.join(repoDir, "..", `pr-reused-fork-${path.basename(repoDir)}`); | |
| 3154 | + const worktreePath = NodePath.join( | |
| 3155 | + repoDir, | |
| 3156 | + "..", | |
| 3157 | + `pr-reused-fork-${NodePath.basename(repoDir)}`, | |
| 3158 | + ); | |
| 3151 | 3159 | yield* runGit(repoDir, ["worktree", "add", worktreePath, "feature/pr-reused-fork"]); |
| 3152 | 3160 | yield* runGit(worktreePath, ["branch", "--unset-upstream"], true); |
| 3153 | 3161 | |
| @@ -3179,8 +3187,8 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 25 unmodified lines | ||
| 3179 | 3187 | mode: "worktree", |
| 3180 | 3188 | }); |
| 3181 | 3189 | |
| 3182 | − expect(result.worktreePath && fs.realpathSync.native(result.worktreePath)).toBe( | |
| 3183 | − fs.realpathSync.native(worktreePath), | |
| 3190 | + expect(result.worktreePath && NodeFS.realpathSync.native(result.worktreePath)).toBe( | |
| 3191 | + NodeFS.realpathSync.native(worktreePath), | |
| 3184 | 3192 | ); |
| 3185 | 3193 | expect( |
| 3186 | 3194 | (yield* runGit(worktreePath, ["rev-parse", "--abbrev-ref", "@{upstream}"])).stdout.trim(), |
| @@ -3196,7 +3204,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 9 unmodified lines | ||
| 3196 | 3204 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 3197 | 3205 | yield* runGit(repoDir, ["push", "-u", "origin", "main"]); |
| 3198 | 3206 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-setup-failure"]); |
| 3199 | − fs.writeFileSync(path.join(repoDir, "setup-failure.txt"), "setup failure\n"); | |
| 3207 | + NodeFS.writeFileSync(NodePath.join(repoDir, "setup-failure.txt"), "setup failure\n"); | |
| 3200 | 3208 | yield* runGit(repoDir, ["add", "setup-failure.txt"]); |
| 3201 | 3209 | yield* runGit(repoDir, ["commit", "-m", "PR setup failure branch"]); |
| 3202 | 3210 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-setup-failure"]); |
| @@ -3236,7 +3244,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 33 unmodified lines | ||
| 3236 | 3244 | |
| 3237 | 3245 | expect(result.branch).toBe("feature/pr-setup-failure"); |
| 3238 | 3246 | expect(result.worktreePath).not.toBeNull(); |
| 3239 | − expect(fs.existsSync(result.worktreePath as string)).toBe(true); | |
| 3247 | + expect(NodeFS.existsSync(result.worktreePath as string)).toBe(true); | |
| 3240 | 3248 | }), |
| 3241 | 3249 | ); |
| 3242 | 3250 | |
| @@ -3276,9 +3284,9 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 33 unmodified lines | ||
| 3276 | 3284 | Effect.gen(function* () { |
| 3277 | 3285 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 3278 | 3286 | yield* initRepo(repoDir); |
| 3279 | − fs.writeFileSync(path.join(repoDir, "hooked.txt"), "hooked\n"); | |
| 3280 | − fs.writeFileSync( | |
| 3281 | − path.join(repoDir, ".git", "hooks", "pre-commit"), | |
| 3287 | + NodeFS.writeFileSync(NodePath.join(repoDir, "hooked.txt"), "hooked\n"); | |
| 3288 | + NodeFS.writeFileSync( | |
| 3289 | + NodePath.join(repoDir, ".git", "hooks", "pre-commit"), | |
| 3282 | 3290 | '#!/bin/sh\necho "hook: start" >&2\nsleep 0.05\necho "hook: end" >&2\n', |
| 3283 | 3291 | { mode: 0o755 }, |
| 3284 | 3292 | ); |
| @@ -3339,9 +3347,9 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 54 unmodified lines | ||
| 3339 | 3347 | Effect.gen(function* () { |
| 3340 | 3348 | const repoDir = yield* makeTempDir("t3code-git-manager-"); |
| 3341 | 3349 | yield* initRepo(repoDir); |
| 3342 | − fs.writeFileSync(path.join(repoDir, "hook-failure.txt"), "broken\n"); | |
| 3343 | − fs.writeFileSync( | |
| 3344 | − path.join(repoDir, ".git", "hooks", "pre-commit"), | |
| 3350 | + NodeFS.writeFileSync(NodePath.join(repoDir, "hook-failure.txt"), "broken\n"); | |
| 3351 | + NodeFS.writeFileSync( | |
| 3352 | + NodePath.join(repoDir, ".git", "hooks", "pre-commit"), | |
| 3345 | 3353 | '#!/bin/sh\necho "hook: fail" >&2\nexit 1\n', |
| 3346 | 3354 | { mode: 0o755 }, |
| 3347 | 3355 | ); |
| @@ -3392,7 +3400,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { · 44 unmodified lines | ||
| 3392 | 3400 | yield* runGit(repoDir, ["checkout", "-b", "feature/pr-only-follow-up"]); |
| 3393 | 3401 | const remoteDir = yield* createBareRemote(); |
| 3394 | 3402 | yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]); |
| 3395 | − fs.writeFileSync(path.join(repoDir, "pr-only.txt"), "pr only\n"); | |
| 3403 | + NodeFS.writeFileSync(NodePath.join(repoDir, "pr-only.txt"), "pr only\n"); | |
| 3396 | 3404 | yield* runGit(repoDir, ["add", "pr-only.txt"]); |
| 3397 | 3405 | yield* runGit(repoDir, ["commit", "-m", "PR only branch"]); |
| 3398 | 3406 | yield* runGit(repoDir, ["push", "-u", "origin", "feature/pr-only-follow-up"]); |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // @effect-diagnostics nodeBuiltinImport:off |
| 2 | −import { existsSync } from "node:fs"; | |
| 3 | −import { join } from "node:path"; | |
| 2 | +import * as NodeFS from "node:fs"; | |
| 3 | +import * as NodePath from "node:path"; | |
| 4 | 4 | |
| 5 | 5 | export function isGitRepository(cwd: string): boolean { |
| 6 | − return existsSync(join(cwd, ".git")); | |
| 6 | + return NodeFS.existsSync(NodePath.join(cwd, ".git")); | |
| 7 | 7 | } |