Skip to content
Draft
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
109 changes: 58 additions & 51 deletions templates/content/AGENTS.md

Large diffs are not rendered by default.

78 changes: 77 additions & 1 deletion templates/content/actions/_database-source-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import {
mockProposedValue,
normalizeSourceFederation,
normalizeSourceFreshness,
sourceValuesForSeededSourceRow,
serializeSourceMetadataRecord,
sourceCapabilitiesForType,
sourceChangeSetKey,
sourceChangeSetSummary,
sourceValuesForSeededSourceRow,
} from "./_database-source-utils";

function property(
Expand Down Expand Up @@ -67,6 +69,45 @@ describe("database source helpers", () => {
expect(normalizeSourceFreshness("mysterious fog")).toBe("unknown");
});

it("describes local folder and GitHub URL sources as repo truth", () => {
expect(
JSON.parse(
serializeSourceMetadataRecord({
sourceType: "local-folder",
sourceTable: "docs",
}),
),
).toMatchObject({
naturalKeyField: "path",
pushMode: "none",
truthSemantics: "local-folder",
});

expect(
JSON.parse(
serializeSourceMetadataRecord({
sourceType: "github-url",
sourceTable:
"https://github.com/BuilderIO/agent-native/tree/main/docs",
}),
),
).toMatchObject({
naturalKeyField: "url",
pushMode: "none",
truthSemantics: "github-url",
});

expect(JSON.parse(sourceCapabilitiesForType("local-folder"))).toMatchObject(
{
canRefresh: false,
canPush: false,
canCreateChangeSets: false,
liveWritesEnabled: false,
readOnlyRefresh: false,
},
);
});

it("drops stored federation metadata with unsafe regex formulas", () => {
expect(
normalizeSourceFederation({
Expand Down Expand Up @@ -901,6 +942,41 @@ describe("database source helpers", () => {
});
});

it("captures local folder and GitHub source values without Builder fields", () => {
const localItem = item("doc-local", "Local doc");
localItem.document.source = {
mode: "local-files",
kind: "file",
path: "docs/local-doc.mdx",
};

expect(
sourceValuesForSeededSourceRow({
sourceType: "local-folder",
item: localItem,
sourceTable: "docs",
now: "2026-06-08T13:00:00.000Z",
}),
).toEqual({
title: "Local doc",
path: "docs/local-doc.mdx",
"sys.truth": "local-folder",
});

expect(
sourceValuesForSeededSourceRow({
sourceType: "github-url",
item: item("doc-github", "GitHub doc"),
sourceTable: "https://github.com/BuilderIO/agent-native/tree/main/docs",
now: "2026-06-08T13:00:00.000Z",
}),
).toEqual({
title: "GitHub doc",
url: "https://github.com/BuilderIO/agent-native/tree/main/docs",
"sys.truth": "github-url",
});
});

it("summarizes proposed changes with the current row title and changed field names", () => {
const headline = property("text", "Launch week");
const fieldChange = buildMockFieldChange({
Expand Down
Loading
Loading