Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
004e0c1
Add Playwright and initial test setup with example tests
null-hype Aug 24, 2025
e804ee1
Set up Storybook with Next.js and Vite integration
null-hype Aug 24, 2025
20958d0
Refactor: Update code formatting in sandbox tasks hook
null-hype Aug 26, 2025
586d540
Refactor: Update UI formatting in project details page
null-hype Aug 26, 2025
8b453f1
Feat: Add template version support in project creation flow
null-hype Aug 26, 2025
5c09024
Test: Setup Playwright testing infrastructure and add test scripts
null-hype Aug 26, 2025
cab0a3c
Feat: Configure Goose server integration in sandbox template
null-hype Aug 26, 2025
5492555
Refactor: Enhance UI formatting on the main page
null-hype Aug 26, 2025
4d5f8c0
Feat: Update devcontainer configuration for Goose integration
null-hype Aug 26, 2025
984419b
Add .zed/debug.json to .gitignore
null-hype Aug 26, 2025
b71eab2
Update postcss config to use plugins object syntax
null-hype Aug 26, 2025
ca6187e
Update dependencies and sandbox configuration
null-hype Aug 26, 2025
9091516
Add Storybook Test Runner and update dependencies
null-hype Aug 27, 2025
c5ce2c1
Update Page.stories.ts
null-hype Aug 27, 2025
96153e4
Update fork-project.test.ts
null-hype Aug 27, 2025
6d41271
Add Playwright test and configure black-thursday project
null-hype Aug 28, 2025
18cac51
Update package.json
null-hype Aug 28, 2025
1b6b8ca
Add Playwright fixture with slug parameter for tests
null-hype Aug 28, 2025
7331392
Add originalDomain and originalSlug fixtures to Playwright tests
null-hype Aug 28, 2025
9210b78
Add OpenAI-based custom matcher to grade translation similarity
null-hype Aug 28, 2025
57939c5
Add original and translated snapshot fixtures for translation tests
null-hype Aug 28, 2025
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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@ next-env.d.ts

# data persistence
/data/

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

*storybook.log
storybook-static

.zed/debug.json
23 changes: 23 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { StorybookConfig } from "@storybook/nextjs-vite";

const config: StorybookConfig = {
"stories": [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
"addons": [
"@chromatic-com/storybook",
"@storybook/addon-docs",
"@storybook/addon-onboarding",
"@storybook/addon-a11y",
"@storybook/addon-vitest"
],
"framework": {
"name": "@storybook/nextjs-vite",
"options": {}
},
"staticDirs": [
"../public"
]
};
export default config;
21 changes: 21 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Preview } from '@storybook/nextjs-vite'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},

a11y: {
// 'todo' - show a11y violations in the test UI only
// 'error' - fail CI on a11y violations
// 'off' - skip a11y checks entirely
test: 'todo'
}
},
};

export default preview;
7 changes: 7 additions & 0 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
import { setProjectAnnotations } from '@storybook/nextjs-vite';
import * as projectAnnotations from './preview';

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
62 changes: 38 additions & 24 deletions app/api/projects/create-stream/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { NextRequest } from "next/server";
import { getAuthenticatedUser } from "../../auth/middleware";
import { getUserById } from "../../auth/store";
import { getCodeSandboxService } from "../../services/codesandbox";
import { validateEnvironment, validateRequiredParams } from "../../utils/responses";
import {
validateEnvironment,
validateRequiredParams,
} from "../../utils/responses";

interface ProgressStep {
id: string;
Expand All @@ -14,7 +17,7 @@ interface ProgressStep {

function createProgressMessage(
type: "progress" | "success" | "error",
data: any
data: any,
): string {
return `data: ${JSON.stringify({ type, ...data })}\n\n`;
}
Expand All @@ -27,16 +30,19 @@ function createProgressMessage(
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const name = searchParams.get("name");
const version = searchParams.get("version") || "latest"; // Default to latest if not specified

if (!name || typeof name !== "string") {
return new Response(
createProgressMessage("error", { message: "Project name is required and must be a non-empty string" }),
createProgressMessage("error", {
message: "Project name is required and must be a non-empty string",
}),
{
status: 400,
headers: {
"Content-Type": "text/plain",
},
}
},
);
}

Expand All @@ -58,13 +64,13 @@ export async function GET(request: NextRequest) {
const sendProgress = (step: ProgressStep) => {
currentStepId = step.status === "in_progress" ? step.id : currentStepId;
controller.enqueue(
encoder.encode(createProgressMessage("progress", { step }))
encoder.encode(createProgressMessage("progress", { step })),
);
};

const sendSuccess = (projectId: string) => {
controller.enqueue(
encoder.encode(createProgressMessage("success", { projectId }))
encoder.encode(createProgressMessage("success", { projectId })),
);
controller.close();
};
Expand All @@ -80,7 +86,7 @@ export async function GET(request: NextRequest) {
});
}
controller.enqueue(
encoder.encode(createProgressMessage("error", { message }))
encoder.encode(createProgressMessage("error", { message })),
);
controller.close();
};
Expand All @@ -107,9 +113,14 @@ export async function GET(request: NextRequest) {

// Validate environment variables
try {
validateEnvironment(['CSB_API_KEY']);
validateEnvironment(["CSB_API_KEY"]);
} catch (error) {
sendError(error instanceof Error ? error.message : "Environment validation failed", "auth");
sendError(
error instanceof Error
? error.message
: "Environment validation failed",
"auth",
);
return;
}

Expand Down Expand Up @@ -151,11 +162,14 @@ export async function GET(request: NextRequest) {
});

const csbService = getCodeSandboxService();
const sandbox = await csbService.createSandbox("sdk-example@latest", "private");
const sandbox = await csbService.createSandbox(
`sdk-example@${version}`, // Use the version parameter here
"private",
);

sendProgress({
id: "sandbox-create",
message: `Sandbox created: ${sandbox.id}`,
message: `Sandbox created: ${sandbox.id} (template: sdk-example@${version})`,
status: "completed",
});

Expand Down Expand Up @@ -191,7 +205,7 @@ export async function GET(request: NextRequest) {
`git remote add origin https://github.com/${user.username}/${repo.data.name}.git`,
{
cwd: "/project/workspace/app",
}
},
);

sendProgress({
Expand All @@ -207,17 +221,17 @@ export async function GET(request: NextRequest) {
status: "in_progress",
});

await client.commands.run(
[
"git add .",
`git commit -m "Initial commit"`,
"git branch -M main",
"git push -u origin main",
],
{
cwd: "/project/workspace/app",
}
);
// await client.commands.run(
// [
// "git add .",
// `git commit -m "Initial commit"`,
// "git branch -M main",
// "git push -u origin main",
// ],
// {
// cwd: "/project/workspace/app",
// }
// );

sendProgress({
id: "git-push",
Expand Down Expand Up @@ -251,7 +265,7 @@ export async function GET(request: NextRequest) {
name,
sandbox.id,
hostToken,
repo.data.html_url
repo.data.html_url,
);

sendProgress({
Expand Down
Loading