@builder.io/ai-utils 0.85.1 → 0.85.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/projects.d.ts +11 -0
- package/src/projects.js +13 -0
- package/src/projects.test.d.ts +1 -0
- package/src/projects.test.js +22 -0
package/package.json
CHANGED
package/src/projects.d.ts
CHANGED
|
@@ -231,6 +231,17 @@ export declare const STARTER_REPO = "BuilderIO/fusion-starter";
|
|
|
231
231
|
export declare const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
|
|
232
232
|
export declare const DSI_PLACEHOLDER_REPO = "BuilderIO/dsi-placeholder";
|
|
233
233
|
export declare const AGENT_NATIVE_STARTER_REPO = "BuilderIO/builder-agent-native-starter";
|
|
234
|
+
/**
|
|
235
|
+
* Whether a repo/workspace-folder refers to the Agent Native starter. Hostable
|
|
236
|
+
* Agent Native projects are born with their own `repoName` (the eagerly
|
|
237
|
+
* provisioned internal host), so the starter is only identifiable via
|
|
238
|
+
* `templateRepoUrl` — the read-only clone source. Matching either keeps both
|
|
239
|
+
* hostable and plain-clone projects working.
|
|
240
|
+
*/
|
|
241
|
+
export declare const matchesAgentNativeStarter: (repo: {
|
|
242
|
+
repoName?: string | null;
|
|
243
|
+
templateRepoUrl?: string | null;
|
|
244
|
+
}) => boolean;
|
|
234
245
|
export declare const EXAMPLE_OR_STARTER_REPOS: string[];
|
|
235
246
|
export declare const EXAMPLE_OR_STARTER_REPOS_URLS: string[];
|
|
236
247
|
export interface GitBackupUploadUrlResult {
|
package/src/projects.js
CHANGED
|
@@ -38,6 +38,19 @@ export const STARTER_REPO = "BuilderIO/fusion-starter";
|
|
|
38
38
|
export const DSI_PREVIEW_REPO = "BuilderIO/dsi-starter";
|
|
39
39
|
export const DSI_PLACEHOLDER_REPO = "BuilderIO/dsi-placeholder";
|
|
40
40
|
export const AGENT_NATIVE_STARTER_REPO = "BuilderIO/builder-agent-native-starter";
|
|
41
|
+
/**
|
|
42
|
+
* Whether a repo/workspace-folder refers to the Agent Native starter. Hostable
|
|
43
|
+
* Agent Native projects are born with their own `repoName` (the eagerly
|
|
44
|
+
* provisioned internal host), so the starter is only identifiable via
|
|
45
|
+
* `templateRepoUrl` — the read-only clone source. Matching either keeps both
|
|
46
|
+
* hostable and plain-clone projects working.
|
|
47
|
+
*/
|
|
48
|
+
export const matchesAgentNativeStarter = (repo) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (repo.repoName === AGENT_NATIVE_STARTER_REPO)
|
|
51
|
+
return true;
|
|
52
|
+
return !!((_a = repo.templateRepoUrl) === null || _a === void 0 ? void 0 : _a.includes(AGENT_NATIVE_STARTER_REPO));
|
|
53
|
+
};
|
|
41
54
|
export const EXAMPLE_OR_STARTER_REPOS = [
|
|
42
55
|
...EXAMPLE_REPOS,
|
|
43
56
|
STARTER_REPO,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { AGENT_NATIVE_STARTER_REPO, matchesAgentNativeStarter, } from "./projects";
|
|
3
|
+
describe("matchesAgentNativeStarter", () => {
|
|
4
|
+
it("matches when repoName is the starter", () => {
|
|
5
|
+
expect(matchesAgentNativeStarter({ repoName: AGENT_NATIVE_STARTER_REPO })).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it("matches hostable projects via templateRepoUrl even when repoName is the internal host", () => {
|
|
8
|
+
expect(matchesAgentNativeStarter({
|
|
9
|
+
repoName: "builder-internal-host/some-project",
|
|
10
|
+
templateRepoUrl: "https://github.com/BuilderIO/builder-agent-native-starter",
|
|
11
|
+
})).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
it("does not match unrelated projects", () => {
|
|
14
|
+
expect(matchesAgentNativeStarter({
|
|
15
|
+
repoName: "acme/dashboard",
|
|
16
|
+
templateRepoUrl: "https://github.com/BuilderIO/fusion-starter",
|
|
17
|
+
})).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
it("does not match when both fields are absent", () => {
|
|
20
|
+
expect(matchesAgentNativeStarter({})).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
});
|