salgadev commited on
Commit
20ff67e
·
verified ·
1 Parent(s): 7bec0df

Sync from GitHub 99a1264a

Browse files
apps/web/app/api/jambuddy/detect/route.ts CHANGED
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
2
  import { execFile } from "node:child_process";
3
  import { promisify } from "node:util";
4
  import { writeFile } from "node:fs/promises";
 
5
  import { tmpdir } from "node:os";
6
  import { join } from "node:path";
7
  import type { BuddyGenre } from "@/lib/jambuddy/prompt";
@@ -33,7 +34,7 @@ export async function POST(req: NextRequest) {
33
  }
34
 
35
  // Resolve repo root + python like the main route.
36
- const exists = (p: string) => require("node:fs").existsSync(p);
37
  let repoRoot: string | null = process.env.JAM_BUDDY_ROOT ?? null;
38
  if (!repoRoot) {
39
  let cur = process.cwd();
 
2
  import { execFile } from "node:child_process";
3
  import { promisify } from "node:util";
4
  import { writeFile } from "node:fs/promises";
5
+ import { existsSync } from "node:fs";
6
  import { tmpdir } from "node:os";
7
  import { join } from "node:path";
8
  import type { BuddyGenre } from "@/lib/jambuddy/prompt";
 
34
  }
35
 
36
  // Resolve repo root + python like the main route.
37
+ const exists = (p: string) => existsSync(p);
38
  let repoRoot: string | null = process.env.JAM_BUDDY_ROOT ?? null;
39
  if (!repoRoot) {
40
  let cur = process.cwd();
apps/web/app/api/jambuddy/route.ts CHANGED
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
2
  import { execFile } from "node:child_process";
3
  import { promisify } from "node:util";
4
  import { writeFile, mkdir, readFile } from "node:fs/promises";
 
5
  import { tmpdir } from "node:os";
6
  import { join } from "node:path";
7
  import { buildPrompt, MODEL_FOR_INSTRUMENT, type BuddyKnobs } from "@/lib/jambuddy/prompt";
@@ -59,7 +60,7 @@ export async function POST(req: NextRequest) {
59
  // contains tools/jam_buddy.py. Walk up from the Next server cwd until we
60
  // find it — the cwd differs between `pnpm dev` (apps/web) and a root-level
61
  // launch, so don't assume a fixed number of levels up. Allow an env override.
62
- const exists = (p: string) => require("node:fs").existsSync(p);
63
  let repoRoot: string | null = process.env.JAM_BUDDY_ROOT ?? null;
64
  if (!repoRoot) {
65
  let cur = process.cwd();
 
2
  import { execFile } from "node:child_process";
3
  import { promisify } from "node:util";
4
  import { writeFile, mkdir, readFile } from "node:fs/promises";
5
+ import { existsSync } from "node:fs";
6
  import { tmpdir } from "node:os";
7
  import { join } from "node:path";
8
  import { buildPrompt, MODEL_FOR_INSTRUMENT, type BuddyKnobs } from "@/lib/jambuddy/prompt";
 
60
  // contains tools/jam_buddy.py. Walk up from the Next server cwd until we
61
  // find it — the cwd differs between `pnpm dev` (apps/web) and a root-level
62
  // launch, so don't assume a fixed number of levels up. Allow an env override.
63
+ const exists = (p: string) => existsSync(p);
64
  let repoRoot: string | null = process.env.JAM_BUDDY_ROOT ?? null;
65
  if (!repoRoot) {
66
  let cur = process.cwd();