@amaster.ai/cli 1.1.34 → 1.1.35
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/cli.cjs +25 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +25 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -890,9 +890,17 @@ function toImportSpecifier(targetPath) {
|
|
|
890
890
|
const normalized = targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
|
|
891
891
|
return removePathExtension(normalized).replace(/\/index$/, "");
|
|
892
892
|
}
|
|
893
|
+
function resolveInstalledAddonDisplay(meta) {
|
|
894
|
+
const legacyMeta = meta;
|
|
895
|
+
return {
|
|
896
|
+
title: meta.display?.title ?? legacyMeta.manifest?.title,
|
|
897
|
+
description: legacyMeta.manifest?.description
|
|
898
|
+
};
|
|
899
|
+
}
|
|
893
900
|
function buildAddonLlmGuidance(input) {
|
|
894
901
|
const pageMembers = input.meta.members.filter((member) => member.type === "page");
|
|
895
902
|
const componentMembers = input.meta.members.filter((member) => member.type === "component");
|
|
903
|
+
const functionMembers = input.meta.members.filter((member) => member.type === "function");
|
|
896
904
|
const settingsMembers = input.meta.members.filter((member) => member.type === "settings");
|
|
897
905
|
const webRoutes = input.meta.members.filter((member) => member.type === "page" && member.page?.web).map((member) => ({
|
|
898
906
|
route: member.page.web.route,
|
|
@@ -910,10 +918,15 @@ function buildAddonLlmGuidance(input) {
|
|
|
910
918
|
name: member.name,
|
|
911
919
|
importFrom: member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : ""
|
|
912
920
|
}));
|
|
921
|
+
const functions = functionMembers.map((member) => ({
|
|
922
|
+
name: member.name,
|
|
923
|
+
targetPaths: member.targetPaths
|
|
924
|
+
}));
|
|
913
925
|
const settings = settingsMembers.map((member) => ({
|
|
914
926
|
targetPath: member.settings?.targetPath || member.targetPaths[0] || "",
|
|
915
927
|
paths: member.settings?.paths.map((item) => item.path) || []
|
|
916
928
|
}));
|
|
929
|
+
const display = resolveInstalledAddonDisplay(input.meta);
|
|
917
930
|
const instructions = [
|
|
918
931
|
"Use the installed Addon files in the host application's existing pages, components, routes, dialogs, or preview areas.",
|
|
919
932
|
"Do not reinstall to complete integration; edit application source files directly."
|
|
@@ -924,6 +937,9 @@ function buildAddonLlmGuidance(input) {
|
|
|
924
937
|
if (componentMembers.length > 0) {
|
|
925
938
|
instructions.push("Use installed component members from their target paths where the application needs them.");
|
|
926
939
|
}
|
|
940
|
+
if (functionMembers.length > 0) {
|
|
941
|
+
instructions.push("Use installed function members by invoking their function names from the host application.");
|
|
942
|
+
}
|
|
927
943
|
if (hasInstallRequirements(input.requirements)) {
|
|
928
944
|
instructions.push("Configure the declared env/secret requirements before running or deploying the application.");
|
|
929
945
|
}
|
|
@@ -931,12 +947,13 @@ function buildAddonLlmGuidance(input) {
|
|
|
931
947
|
instructions.push("NPM dependencies have been written to package.json; avoid adding duplicate dependency entries.");
|
|
932
948
|
}
|
|
933
949
|
return {
|
|
934
|
-
summary:
|
|
950
|
+
summary: display.description || display.title || `Installed addon ${input.meta.name}@${input.meta.version}.`,
|
|
935
951
|
instructions,
|
|
936
952
|
prompt: input.promptContent ? { path: "PROMPT.md", content: input.promptContent } : void 0,
|
|
937
953
|
webRoutes: webRoutes.length ? webRoutes : void 0,
|
|
938
954
|
miniPages: miniPages.length ? miniPages : void 0,
|
|
939
955
|
components: components.length ? components : void 0,
|
|
956
|
+
functions: functions.length ? functions : void 0,
|
|
940
957
|
settings: settings.length ? settings : void 0,
|
|
941
958
|
requirements: hasInstallRequirements(input.requirements) ? input.requirements : void 0,
|
|
942
959
|
npm: hasNpmDependencies(input.npm) ? input.npm : void 0
|
|
@@ -1128,6 +1145,9 @@ async function buildInstallPlan(options) {
|
|
|
1128
1145
|
case "datasource":
|
|
1129
1146
|
targetBaseRelativeDir = join("src", "db", "datasource");
|
|
1130
1147
|
break;
|
|
1148
|
+
case "function":
|
|
1149
|
+
targetBaseRelativeDir = join("src", "functions");
|
|
1150
|
+
break;
|
|
1131
1151
|
default:
|
|
1132
1152
|
throw new Error(`Unsupported addon member type: ${member.type}`);
|
|
1133
1153
|
}
|
|
@@ -1201,13 +1221,8 @@ function buildInstalledAddonMeta(options) {
|
|
|
1201
1221
|
organizationCode: options.organizationCode,
|
|
1202
1222
|
installedAt,
|
|
1203
1223
|
updatedAt: now,
|
|
1204
|
-
|
|
1205
|
-
title: options.manifest.display.title
|
|
1206
|
-
description: options.manifest.display.description,
|
|
1207
|
-
category: options.manifest.display.category,
|
|
1208
|
-
applicationTypes: options.manifest.compatibility.applicationTypes,
|
|
1209
|
-
phases: options.manifest.compatibility.phases,
|
|
1210
|
-
memberTypes: [...new Set(options.manifest.members.map((member) => member.type))]
|
|
1224
|
+
display: {
|
|
1225
|
+
title: options.manifest.display.title
|
|
1211
1226
|
},
|
|
1212
1227
|
installParameters: options.installParameters,
|
|
1213
1228
|
requirements: resolveInstallRequirements(options.manifest),
|
|
@@ -1742,7 +1757,8 @@ async function materializeAddon(options) {
|
|
|
1742
1757
|
installedAt: previousMeta?.installedAt
|
|
1743
1758
|
});
|
|
1744
1759
|
await ensureParentDirectory(plan.metaPath);
|
|
1745
|
-
await writeFile(plan.metaPath, JSON.stringify(meta, null, 2)
|
|
1760
|
+
await writeFile(plan.metaPath, `${JSON.stringify(meta, null, 2)}
|
|
1761
|
+
`);
|
|
1746
1762
|
if (options.installPackageDependencies && packageJsonFiles.length) {
|
|
1747
1763
|
await installPackageDependencies(targetDir);
|
|
1748
1764
|
}
|