Skip to content

feat(core): print clickable dev-server URLs and dev-bypass shortcut#1382

Open
ascorbic wants to merge 1 commit into
mainfrom
feat/dev-server-clickable-urls
Open

feat(core): print clickable dev-server URLs and dev-bypass shortcut#1382
ascorbic wants to merge 1 commit into
mainfrom
feat/dev-server-clickable-urls

Conversation

@ascorbic

@ascorbic ascorbic commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Improves the astro dev startup output for EmDash:

  • Prints absolute, clickable URLs for the admin UI (and the MCP server when enabled) once the dev server is listening, instead of bare relative paths printed before the port was known.
  • Adds a dev-bypass shortcut link (/_emdash/api/setup/dev-bypass?redirect=/_emdash/admin) that signs you in as a dev admin without passkey setup/auth. Dev-only -- the underlying endpoint already returns 403 in production.
  • Shows the installed EmDash version in the startup banner.

Route printing moved from astro:config:setup to the astro:server:setup listening hook (gated on command === "dev") since the port isn't known earlier and the bypass shortcut only applies to dev.

Closes #

Type of change

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable) -- n/a, dev-server console output only
  • User-visible strings in the admin UI are wrapped for translation (if applicable) -- n/a, dev-server console output is English-only like other CLI output
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion

AI-generated code disclosure

  • This PR includes AI-generated code -- model/tool: Claude Opus 4.8 (opencode)

Screenshots / test output

Verified locally: pnpm typecheck and pnpm lint:json both clean.

Copilot AI review requested due to automatic review settings June 8, 2026 09:22
@changeset-bot

changeset-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9867cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs c9867cd Jun 08 2026, 09:23 AM

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jun 8, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
emdash-playground c9867cd Jun 08 2026, 09:23 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache c9867cd Jun 08 2026, 09:24 AM

@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1382

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1382

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1382

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1382

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1382

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1382

emdash

npm i https://pkg.pr.new/emdash@1382

create-emdash

npm i https://pkg.pr.new/create-emdash@1382

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1382

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1382

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1382

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1382

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1382

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1382

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1382

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1382

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1382

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1382

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1382

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1382

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1382

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1382

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1382

commit: c9867cd

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

PR template validation failed

Please fix the following issues by editing your PR description:

See CONTRIBUTING.md for the full contribution policy.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the EmDash Astro integration’s astro dev startup output by moving route/link printing to the point where the dev server is actually listening (so the port is known), and by adding a dev-only bypass link plus the installed EmDash version in the banner.

Changes:

  • Print the EmDash version in the startup banner.
  • Print absolute (clickable) dev-server URLs for Admin UI and (optionally) MCP once the dev server is listening, and include a dev-bypass shortcut link.
  • Add a Changeset documenting the new dev-server output behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/astro/integration/index.ts Adds version to banner and prints absolute dev URLs (including dev-bypass) from the server listening hook.
.changeset/dev-server-clickable-urls.md Declares a minor release and documents the dev-server clickable URL output changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +405 to +410
const address = server.httpServer?.address();
if (!address || typeof address === "string") return;
printDevServerInfo(
`http://${address.address === "::1" ? "localhost" : address.address}:${address.port}`,
resolvedConfig.mcp !== false,
);
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-review No maintainer or bot review yet labels Jun 8, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Jun 8, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sensible developer-experience improvement. Moving route printing to astro:server:setup so the actual bound port is known makes absolute URLs possible, and surfacing the dev-bypass shortcut alongside the version in the startup banner is useful without adding any new runtime surface area.

I found one issue that undermines the PR's stated goal: the URL construction from server.httpServer.address() does not handle IPv6 correctly. When the dev server binds to :: (all-interfaces IPv6) or any specific IPv6 address, the generated string lacks brackets and browsers will not navigate to it (e.g. http://:::4321). This is a real bug for users on IPv6-first systems or using --host.

Otherwise the changes look clean: the VERSION import path follows repo conventions, the mcp !== false check is consistent with route injection, and the astroCommand capture is simple and safe. The changeset is appropriate.

Comment on lines +404 to +406
server.httpServer?.once("listening", () => {
const address = server.httpServer?.address();
if (!address || typeof address === "string") return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[needs fixing] The URL formatting from server.httpServer.address() is broken for IPv6 addresses other than ::1. When the dev server binds to :: (all interfaces) or a specific IPv6 address, the resulting string lacks brackets and is not a valid URL — for example http://:::4321. This defeats the PR's goal of "clickable URLs" on IPv6-enabled systems or when using --host.

Bracket IPv6 addresses and map :: / 0.0.0.0 to localhost, matching Vite's own behavior:

Suggested change
server.httpServer?.once("listening", () => {
const address = server.httpServer?.address();
if (!address || typeof address === "string") return;
server.httpServer?.once("listening", () => {
const address = server.httpServer?.address();
if (!address || typeof address === "string") return;
let host = address.address;
if (host === "::1" || host === "::" || host === "0.0.0.0") {
host = "localhost";
} else if (address.family === "IPv6") {
host = `[${host}]`;
}
printDevServerInfo(
`http://${host}:${address.port}`,
resolvedConfig.mcp !== false,
);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core bot:review Trigger an emdashbot code review on this PR cla: signed review/awaiting-author Reviewed; waiting on the author to respond size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants