@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 CHANGED
@@ -917,9 +917,17 @@ function toImportSpecifier(targetPath) {
917
917
  const normalized = targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
918
918
  return removePathExtension(normalized).replace(/\/index$/, "");
919
919
  }
920
+ function resolveInstalledAddonDisplay(meta) {
921
+ const legacyMeta = meta;
922
+ return {
923
+ title: meta.display?.title ?? legacyMeta.manifest?.title,
924
+ description: legacyMeta.manifest?.description
925
+ };
926
+ }
920
927
  function buildAddonLlmGuidance(input) {
921
928
  const pageMembers = input.meta.members.filter((member) => member.type === "page");
922
929
  const componentMembers = input.meta.members.filter((member) => member.type === "component");
930
+ const functionMembers = input.meta.members.filter((member) => member.type === "function");
923
931
  const settingsMembers = input.meta.members.filter((member) => member.type === "settings");
924
932
  const webRoutes = input.meta.members.filter((member) => member.type === "page" && member.page?.web).map((member) => ({
925
933
  route: member.page.web.route,
@@ -937,10 +945,15 @@ function buildAddonLlmGuidance(input) {
937
945
  name: member.name,
938
946
  importFrom: member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : ""
939
947
  }));
948
+ const functions = functionMembers.map((member) => ({
949
+ name: member.name,
950
+ targetPaths: member.targetPaths
951
+ }));
940
952
  const settings = settingsMembers.map((member) => ({
941
953
  targetPath: member.settings?.targetPath || member.targetPaths[0] || "",
942
954
  paths: member.settings?.paths.map((item) => item.path) || []
943
955
  }));
956
+ const display = resolveInstalledAddonDisplay(input.meta);
944
957
  const instructions = [
945
958
  "Use the installed Addon files in the host application's existing pages, components, routes, dialogs, or preview areas.",
946
959
  "Do not reinstall to complete integration; edit application source files directly."
@@ -951,6 +964,9 @@ function buildAddonLlmGuidance(input) {
951
964
  if (componentMembers.length > 0) {
952
965
  instructions.push("Use installed component members from their target paths where the application needs them.");
953
966
  }
967
+ if (functionMembers.length > 0) {
968
+ instructions.push("Use installed function members by invoking their function names from the host application.");
969
+ }
954
970
  if (hasInstallRequirements(input.requirements)) {
955
971
  instructions.push("Configure the declared env/secret requirements before running or deploying the application.");
956
972
  }
@@ -958,12 +974,13 @@ function buildAddonLlmGuidance(input) {
958
974
  instructions.push("NPM dependencies have been written to package.json; avoid adding duplicate dependency entries.");
959
975
  }
960
976
  return {
961
- summary: input.meta.manifest.description || input.meta.manifest.title || `Installed addon ${input.meta.name}@${input.meta.version}.`,
977
+ summary: display.description || display.title || `Installed addon ${input.meta.name}@${input.meta.version}.`,
962
978
  instructions,
963
979
  prompt: input.promptContent ? { path: "PROMPT.md", content: input.promptContent } : void 0,
964
980
  webRoutes: webRoutes.length ? webRoutes : void 0,
965
981
  miniPages: miniPages.length ? miniPages : void 0,
966
982
  components: components.length ? components : void 0,
983
+ functions: functions.length ? functions : void 0,
967
984
  settings: settings.length ? settings : void 0,
968
985
  requirements: hasInstallRequirements(input.requirements) ? input.requirements : void 0,
969
986
  npm: hasNpmDependencies(input.npm) ? input.npm : void 0
@@ -1155,6 +1172,9 @@ async function buildInstallPlan(options) {
1155
1172
  case "datasource":
1156
1173
  targetBaseRelativeDir = path.join("src", "db", "datasource");
1157
1174
  break;
1175
+ case "function":
1176
+ targetBaseRelativeDir = path.join("src", "functions");
1177
+ break;
1158
1178
  default:
1159
1179
  throw new Error(`Unsupported addon member type: ${member.type}`);
1160
1180
  }
@@ -1228,13 +1248,8 @@ function buildInstalledAddonMeta(options) {
1228
1248
  organizationCode: options.organizationCode,
1229
1249
  installedAt,
1230
1250
  updatedAt: now,
1231
- manifest: {
1232
- title: options.manifest.display.title,
1233
- description: options.manifest.display.description,
1234
- category: options.manifest.display.category,
1235
- applicationTypes: options.manifest.compatibility.applicationTypes,
1236
- phases: options.manifest.compatibility.phases,
1237
- memberTypes: [...new Set(options.manifest.members.map((member) => member.type))]
1251
+ display: {
1252
+ title: options.manifest.display.title
1238
1253
  },
1239
1254
  installParameters: options.installParameters,
1240
1255
  requirements: resolveInstallRequirements(options.manifest),
@@ -1769,7 +1784,8 @@ async function materializeAddon(options) {
1769
1784
  installedAt: previousMeta?.installedAt
1770
1785
  });
1771
1786
  await ensureParentDirectory(plan.metaPath);
1772
- await promises$1.writeFile(plan.metaPath, JSON.stringify(meta, null, 2));
1787
+ await promises$1.writeFile(plan.metaPath, `${JSON.stringify(meta, null, 2)}
1788
+ `);
1773
1789
  if (options.installPackageDependencies && packageJsonFiles.length) {
1774
1790
  await installPackageDependencies(targetDir);
1775
1791
  }