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