Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/init-canonical-doc-urls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"neon": patch
---

Point `neon init`'s doc hints at canonical `neon.com/docs` pages instead of the retired skill-reference URLs, and rename the `skillReferences` field to `docReferences`.
380 changes: 190 additions & 190 deletions packages/cli/src/init/__snapshots__/agent_snapshot.test.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/src/init/phases/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe("handleDbPhase", () => {
expect(result.nextAction.steps).toHaveLength(3);
expect(result.nextAction.steps[0].command).toContain("proj-xyz");
expect(result.nextAction.prerequisite).toContain(
"connection-methods",
"choose-connection",
);
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/init/phases/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { neonctlCmd } from "../neonctl.js";
import { SKILL_REFERENCE_URLS } from "../skills.js";
import { DOC_REFERENCE_URLS } from "../skills.js";
import type { PhaseResponse } from "../types.js";

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ export async function handleDbPhase(
project: { id: options.projectId },
nextAction: {
type: "agent_action",
prerequisite: SKILL_REFERENCE_URLS.connectionMethods,
prerequisite: DOC_REFERENCE_URLS.connectionMethods,
steps: [
{
id: "get_connection_string",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/init/phases/getting_started.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("getting-started phase", () => {

if (result.nextAction.type === "agent_action") {
expect(result.nextAction.prerequisite).toContain(
"getting-started.md",
"backend-overview.md",
);
expect(result.nextAction.onComplete.type).toBe("run_neon_init");
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/init/phases/getting_started.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
resolvePackageManager,
} from "../../utils/package_manager.js";
import { neonctlCmd } from "../neonctl.js";
import { ensureSkillsUpToDate, SKILL_REFERENCE_URLS } from "../skills.js";
import { DOC_REFERENCE_URLS, ensureSkillsUpToDate } from "../skills.js";
import type { PhaseResponse } from "../types.js";

export type GettingStartedPhaseOptions = {
Expand Down Expand Up @@ -264,7 +264,7 @@ export async function handleGettingStartedPhase(
status: "getting_started",
nextAction: {
type: "agent_action",
prerequisite: SKILL_REFERENCE_URLS.gettingStarted,
prerequisite: DOC_REFERENCE_URLS.gettingStarted,
steps,
onComplete: buildOnComplete(options),
},
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/init/phases/neon_auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { neonctlCmd } from "../neonctl.js";
import { ensureSkillsUpToDate, SKILL_REFERENCE_URLS } from "../skills.js";
import { DOC_REFERENCE_URLS, ensureSkillsUpToDate } from "../skills.js";
import type { PhaseResponse } from "../types.js";

export type NeonAuthPhaseOptions = {
Expand Down Expand Up @@ -36,7 +36,7 @@ export async function handleNeonAuthPhase(
{ value: "yes", label: "Yes, set up Neon Auth" },
{ value: "no", label: "No, skip for now" },
],
context: `Full documentation: ${SKILL_REFERENCE_URLS.neonAuth}`,
context: `Full documentation: ${DOC_REFERENCE_URLS.neonAuth}`,
responseMapping: {
yes: {
args: [
Expand Down Expand Up @@ -72,7 +72,7 @@ export async function handleNeonAuthPhase(
status: "in_progress",
nextAction: {
type: "agent_action",
prerequisite: SKILL_REFERENCE_URLS.neonAuth,
prerequisite: DOC_REFERENCE_URLS.neonAuth,
steps: [
{
id: "provision",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/init/phases/skills.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getSkillsAgentName } from "../agents.js";
import { SKILL_REFERENCE_URLS } from "../skills.js";
import { DOC_REFERENCE_URLS } from "../skills.js";
import type { Editor, PhaseResponse } from "../types.js";

export type SkillsPhaseOptions = {
Expand Down Expand Up @@ -73,7 +73,7 @@ export async function handleSkillsPhase(
},
},
},
skillReferences: SKILL_REFERENCE_URLS,
docReferences: DOC_REFERENCE_URLS,
};
}

Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/init/skills.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, test } from "vitest";
import { SKILL_REFERENCE_URLS } from "./skills.js";
import { DOC_REFERENCE_URLS } from "./skills.js";

describe("SKILL_REFERENCE_URLS", () => {
describe("DOC_REFERENCE_URLS", () => {
test("contains gettingStarted URL", () => {
expect(SKILL_REFERENCE_URLS.gettingStarted).toBe(
"https://neon.com/docs/ai/skills/neon-postgres/references/getting-started.md",
expect(DOC_REFERENCE_URLS.gettingStarted).toBe(
"https://neon.com/docs/get-started/backend-overview.md",
);
});

Expand All @@ -20,13 +20,13 @@ describe("SKILL_REFERENCE_URLS", () => {
"neonJs",
];
for (const key of expectedKeys) {
expect(SKILL_REFERENCE_URLS).toHaveProperty(key);
expect(SKILL_REFERENCE_URLS[key]).toMatch(/^https:\/\/neon\.com\//);
expect(DOC_REFERENCE_URLS).toHaveProperty(key);
expect(DOC_REFERENCE_URLS[key]).toMatch(/^https:\/\/neon\.com\//);
}
});

test("all URLs end with .md", () => {
for (const url of Object.values(SKILL_REFERENCE_URLS)) {
for (const url of Object.values(DOC_REFERENCE_URLS)) {
expect(url).toMatch(/\.md$/);
}
});
Expand Down
27 changes: 15 additions & 12 deletions packages/cli/src/init/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,21 @@ export function getSkillList(preview?: boolean): string[] {
return preview ? [...BASE_SKILLS, ...PREVIEW_SKILLS] : BASE_SKILLS;
}

const SKILL_BASE_URL =
"https://neon.com/docs/ai/skills/neon-postgres/references";

export const SKILL_REFERENCE_URLS: Record<string, string> = {
gettingStarted: `${SKILL_BASE_URL}/getting-started.md`,
connectionMethods: `${SKILL_BASE_URL}/connection-methods.md`,
neonAuth: `${SKILL_BASE_URL}/neon-auth.md`,
serverlessDriver: `${SKILL_BASE_URL}/neon-serverless.md`,
neonCli: `${SKILL_BASE_URL}/neon-cli.md`,
devtools: `${SKILL_BASE_URL}/devtools.md`,
branching: `${SKILL_BASE_URL}/branching.md`,
neonJs: `${SKILL_BASE_URL}/neon-js.md`,
// Canonical docs URLs surfaced to agents as `prerequisite`/`context` hints. The
// old `/docs/ai/skills/neon-postgres/references/*.md` skill files were retired
// and now redirect here, so we point at the canonical pages directly rather than
// rely on the redirect hop.
const DOCS_BASE_URL = "https://neon.com/docs";

export const DOC_REFERENCE_URLS: Record<string, string> = {
gettingStarted: `${DOCS_BASE_URL}/get-started/backend-overview.md`,
connectionMethods: `${DOCS_BASE_URL}/connect/choose-connection.md`,
neonAuth: `${DOCS_BASE_URL}/auth/overview.md`,
serverlessDriver: `${DOCS_BASE_URL}/serverless/serverless-driver.md`,
neonCli: `${DOCS_BASE_URL}/cli/install.md`,
devtools: `${DOCS_BASE_URL}/reference/api.md`,
branching: `${DOCS_BASE_URL}/introduction/branching.md`,
neonJs: `${DOCS_BASE_URL}/reference/javascript-sdk.md`,
};

/**
Expand Down
Loading