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