Repository navigation
feat: refactor Nova app routing and enhance entry point functionality: #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { requireAuth } from "@/modules/components/utils/auth-utils" | ||
| import { NovaApp } from "@/modules/nova-web/nova-app" | ||
| import { listAgentSessions } from "@/modules/nova/sessions/service" | ||
|
|
||
| export const dynamic = "force-dynamic" | ||
|
|
||
| export default async function NovaHomePage() { | ||
| const session = await requireAuth() | ||
| const sessions = await listAgentSessions(session.user.id) | ||
|
|
||
| return ( | ||
| <NovaApp | ||
| initialSessions={sessions} | ||
| initialView="home" | ||
| user={{ | ||
| id: session.user.id, | ||
| name: session.user.name, | ||
| email: session.user.email, | ||
| image: session.user.image, | ||
| }} | ||
| /> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,5 @@ | ||
| import { requireAuth } from "@/modules/components/utils/auth-utils" | ||
| import { NovaApp } from "@/modules/nova-web/nova-app" | ||
| import { listAgentSessions } from "@/modules/nova/sessions/service" | ||
| import { NovaEntry } from "@/modules/nova-web/nova-entry" | ||
|
|
||
| export const dynamic = "force-dynamic" | ||
|
|
||
| export default async function NovaHomePage() { | ||
| const session = await requireAuth() | ||
| const sessions = await listAgentSessions(session.user.id) | ||
|
|
||
| return ( | ||
| <NovaApp | ||
| initialSessions={sessions} | ||
| initialView="home" | ||
| user={{ | ||
| id: session.user.id, | ||
| name: session.user.name, | ||
| email: session.user.email, | ||
| image: session.user.image, | ||
| }} | ||
| /> | ||
| ) | ||
| export default function NovaEntryPage() { | ||
| return <NovaEntry /> | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
| import { NextRequest } from "next/server" | ||
| import { proxy } from "../../proxy" | ||
| import { metadata } from "../../app/(nova-app)/layout" | ||
|
|
||
| function route(path: string, host = "nova.supercodeai.tech") { | ||
| return proxy(new NextRequest(`https://${host}${path}`, { headers: { host } })) | ||
| } | ||
|
|
||
| describe("Nova link previews", () => { | ||
| test("rewrites public root separately from the authenticated app", () => { | ||
| expect(route("/").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal") | ||
| expect(route("/app").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal/app") | ||
| expect(route("/?ref=share").headers.get("x-middleware-rewrite")).toBe("https://nova.supercodeai.tech/nova-app-internal?ref=share") | ||
| }) | ||
|
|
||
| test("does not change main site or login routing", () => { | ||
| expect(route("/", "supercodeai.tech").headers.get("x-middleware-rewrite")).toBeNull() | ||
| expect(route("/login").headers.get("x-middleware-rewrite")).toBeNull() | ||
| }) | ||
|
|
||
| test("uses the Nova domain and image for both social preview formats", () => { | ||
| expect(metadata.metadataBase?.href).toBe("https://nova.supercodeai.tech/") | ||
| expect(metadata.openGraph?.images).toEqual([{ | ||
| url: "/Nova-OG-image.jpg", | ||
| width: 1200, | ||
| height: 630, | ||
| alt: "Nova — your Supercode engineering agent", | ||
| }]) | ||
| expect(metadata.twitter?.images).toEqual(["/Nova-OG-image.jpg"]) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| "use client" | ||
|
|
||
| import { useEffect } from "react" | ||
|
|
||
| import { NovaIcon } from "@/modules/nova-web/components/nova-icon" | ||
|
|
||
| export function NovaEntry() { | ||
| useEffect(() => { | ||
| window.location.replace(`/app${window.location.search}${window.location.hash}`) | ||
| }, []) | ||
|
|
||
| return ( | ||
| <main className="flex min-h-svh items-center justify-center bg-[#0c0c0c] text-[#e8e8e8]"> | ||
| <a | ||
| href="/app" | ||
| aria-label="Open Nova" | ||
| className="rounded-2xl focus-visible:outline-2 focus-visible:outline-offset-8 focus-visible:outline-white" | ||
| > | ||
| <span className="block motion-safe:animate-pulse"> | ||
| <NovaIcon size="lg" className="size-16" alt="" /> | ||
| </span> | ||
| <span role="status" className="sr-only">Loading Nova…</span> | ||
| </a> | ||
| </main> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing New thread, home, and settings-back actions still navigate to
/. They now mountNovaEntry, whosewindow.location.replacereloads the browser at/appand clears the selected project held inmemoryStateandvirtualProject.The fresh home does not restore that project, so the next normal prompt creates a session with
localProjectId: null. Previously, client navigation kept the project in memory. Point in-app home actions at/appso they skip the public entry redirect.