@sidecar-ai/cli 0.1.0-alpha.0 → 0.1.0-alpha.1
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/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1736,7 +1736,6 @@ function hasProperty(definition, propertyName) {
|
|
|
1736
1736
|
// packages/compiler/src/diagnostics.ts
|
|
1737
1737
|
import { existsSync as existsSync3 } from "fs";
|
|
1738
1738
|
import { readFile as readFile2 } from "fs/promises";
|
|
1739
|
-
import { createRequire } from "module";
|
|
1740
1739
|
import path6 from "path";
|
|
1741
1740
|
async function collectProjectDiagnostics(rootDir, input) {
|
|
1742
1741
|
const diagnostics = [];
|
|
@@ -1745,7 +1744,6 @@ async function collectProjectDiagnostics(rootDir, input) {
|
|
|
1745
1744
|
const prompts = Array.isArray(input) ? [] : input.prompts ?? [];
|
|
1746
1745
|
const config = Array.isArray(input) ? void 0 : input.config;
|
|
1747
1746
|
const hasAuthConfig = existsSync3(path6.join(rootDir, "auth.ts"));
|
|
1748
|
-
const hasOpenAiAppsSdkUi = canResolveOpenAiAppsSdkUi(rootDir);
|
|
1749
1747
|
for (const entry of tools) {
|
|
1750
1748
|
const toolPath = path6.join(rootDir, entry.sourceFile);
|
|
1751
1749
|
const toolSource = await readFile2(toolPath, "utf8");
|
|
@@ -1753,7 +1751,7 @@ async function collectProjectDiagnostics(rootDir, input) {
|
|
|
1753
1751
|
if (entry.widget) {
|
|
1754
1752
|
const widgetPath = path6.join(rootDir, entry.widget.sourceFile);
|
|
1755
1753
|
const widgetSource = await readFile2(widgetPath, "utf8");
|
|
1756
|
-
diagnostics.push(...diagnoseWidgetSource(rootDir, entry, widgetSource
|
|
1754
|
+
diagnostics.push(...diagnoseWidgetSource(rootDir, entry, widgetSource));
|
|
1757
1755
|
}
|
|
1758
1756
|
}
|
|
1759
1757
|
for (const entry of resources) {
|
|
@@ -1854,7 +1852,7 @@ function diagnoseToolSource(rootDir, entry, source, hasAuthConfig) {
|
|
|
1854
1852
|
}
|
|
1855
1853
|
return diagnostics.filter((diagnostic) => !isIgnored(source, diagnostic.code));
|
|
1856
1854
|
}
|
|
1857
|
-
function diagnoseWidgetSource(_rootDir, entry, source
|
|
1855
|
+
function diagnoseWidgetSource(_rootDir, entry, source) {
|
|
1858
1856
|
const diagnostics = [];
|
|
1859
1857
|
const widgetFile = entry.widget?.sourceFile;
|
|
1860
1858
|
if (!widgetFile) {
|
|
@@ -1890,16 +1888,6 @@ function diagnoseWidgetSource(_rootDir, entry, source, hasOpenAiAppsSdkUi) {
|
|
|
1890
1888
|
hint: "Use @sidecar-ai/native for portable primitives. Keep @sidecar-ai/openai/components for widgets intentionally targeted to ChatGPT."
|
|
1891
1889
|
});
|
|
1892
1890
|
}
|
|
1893
|
-
if (/@sidecar-ai\/openai\/components/.test(source) && !hasOpenAiAppsSdkUi && !isIgnored(source, "SIDECAR_OPENAI_UI_SDK_MISSING")) {
|
|
1894
|
-
diagnostics.push({
|
|
1895
|
-
severity: "error",
|
|
1896
|
-
code: "SIDECAR_OPENAI_UI_SDK_MISSING",
|
|
1897
|
-
message: `Widget for "${entry.id}" imports @sidecar-ai/openai/components but @openai/apps-sdk-ui is not installed.`,
|
|
1898
|
-
filePath: widgetFile,
|
|
1899
|
-
...locate(source, "@sidecar-ai/openai/components"),
|
|
1900
|
-
hint: "Install it with: npm install @openai/apps-sdk-ui"
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
1903
1891
|
if (entry.widget?.variant !== "anthropic" && /@sidecar-ai\/anthropic\/components/.test(source) && !isIgnored(source, "SIDECAR_ANTHROPIC_COMPONENT_CROSS_HOST")) {
|
|
1904
1892
|
diagnostics.push({
|
|
1905
1893
|
severity: "warning",
|
|
@@ -1989,14 +1977,6 @@ function hasCompanyKnowledgeShape(schema) {
|
|
|
1989
1977
|
const id = properties.id;
|
|
1990
1978
|
return query?.type === "string" || url?.type === "string" || id?.type === "string";
|
|
1991
1979
|
}
|
|
1992
|
-
function canResolveOpenAiAppsSdkUi(rootDir) {
|
|
1993
|
-
try {
|
|
1994
|
-
createRequire(path6.join(rootDir, "package.json")).resolve("@openai/apps-sdk-ui/css");
|
|
1995
|
-
return true;
|
|
1996
|
-
} catch {
|
|
1997
|
-
return false;
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
1980
|
function locate(source, needle) {
|
|
2001
1981
|
const index = Math.max(0, source.indexOf(needle));
|
|
2002
1982
|
const prefix = source.slice(0, index);
|