@amaster.ai/cli 1.1.32 → 1.1.33

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/README.md CHANGED
@@ -75,6 +75,7 @@ marketplace/screenshots/preview.png
75
75
  这些文件只用于发布到 Addon Marketplace,不会被 `addon install` 安装到应用工程。
76
76
 
77
77
  `addon search` 在未显式传 `--application-type` 时,会从当前目录向上查找最近的 `package.json`,读取同级 `app.settings.yml` 的 `type`,并自动按 `web` 或 `mini` 过滤。
78
+ `addon search --json` 返回面向 MCP/AI 的轻量结果,只包含 `name`、`version`、`installSpecifier`、标题、描述、类目、适用类型、阶段、成员类型和主图地址。
78
79
 
79
80
  常用参数:
80
81
 
@@ -144,12 +145,13 @@ Addon 可在 `addon.json` 中声明安装后的运行配置要求:
144
145
  - CLI 只复制页面文件并写入 `src/addons/{addonName}/meta.json`
145
146
  - CLI 不自动修改 `src/routes.tsx` 或 `src/app.config.ts`
146
147
  - 安装/升级结果会返回 `llmGuidance`,由大模型按当前应用结构接入 web routes、mini pages 和 tabBar
148
+ - `addon install/upgrade --json` 只返回精简消费视图,不返回完整安装元数据、文件 hash、发布物料或数据库 id
147
149
 
148
150
  显式接入指导:
149
151
 
150
- - Addon 包根目录可以放 `SKILL.md`
151
- - `SKILL.md` 不会安装到应用工程,只会在安装/升级结果的 `llmGuidance.skill` 中返回给大模型
152
- - 如果 Addon 本身就是一个 skill 资源,应在 `addon.json.members` 中显式声明 `type: "skill"`;普通 Addon 的根 `SKILL.md` 只作为模型指导
152
+ - Addon 包根目录可以放 `PROMPT.md`
153
+ - `PROMPT.md` 不会安装到应用工程,只会在安装/升级结果的 `llmGuidance.prompt` 中返回给大模型
154
+ - 如果 Addon 本身就是一个 skill 资源,应在 `addon.json.members` 中显式声明 `type: "skill"`;普通 Addon 的根 `PROMPT.md` 只作为模型指导
153
155
 
154
156
  升级策略:
155
157
 
package/dist/cli.cjs CHANGED
@@ -910,6 +910,13 @@ function hasInstallRequirements(requirements) {
910
910
  function hasNpmDependencies(npm) {
911
911
  return Boolean(Object.keys(npm.dependencies ?? {}).length);
912
912
  }
913
+ function removePathExtension(path) {
914
+ return path.replace(/\.[^/.]+$/, "");
915
+ }
916
+ function toImportSpecifier(targetPath) {
917
+ const normalized = targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
918
+ return removePathExtension(normalized).replace(/\/index$/, "");
919
+ }
913
920
  function buildAddonLlmGuidance(input) {
914
921
  const pageMembers = input.meta.members.filter((member) => member.type === "page");
915
922
  const componentMembers = input.meta.members.filter((member) => member.type === "component");
@@ -928,16 +935,15 @@ function buildAddonLlmGuidance(input) {
928
935
  }));
929
936
  const components = componentMembers.map((member) => ({
930
937
  name: member.name,
931
- importFrom: member.targetPaths[0] || "",
932
- targetPaths: member.targetPaths
938
+ importFrom: member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : ""
933
939
  }));
934
940
  const settings = settingsMembers.map((member) => ({
935
941
  targetPath: member.settings?.targetPath || member.targetPaths[0] || "",
936
942
  paths: member.settings?.paths.map((item) => item.path) || []
937
943
  }));
938
944
  const instructions = [
939
- `Addon ${input.meta.name}@${input.meta.version} has been ${input.operation === "install" ? "installed" : "upgraded"} into the application files.`,
940
- "Do not run the install command again to apply integration steps; edit the application source files directly."
945
+ "Use the installed Addon files in the host application's existing pages, components, routes, dialogs, or preview areas.",
946
+ "Do not reinstall to complete integration; edit application source files directly."
941
947
  ];
942
948
  if (pageMembers.length > 0) {
943
949
  instructions.push("Wire the installed page members into the application's existing routing/configuration style.");
@@ -954,7 +960,7 @@ function buildAddonLlmGuidance(input) {
954
960
  return {
955
961
  summary: input.meta.manifest.description || input.meta.manifest.title || `Installed addon ${input.meta.name}@${input.meta.version}.`,
956
962
  instructions,
957
- skill: input.skillContent ? { path: "SKILL.md", content: input.skillContent } : void 0,
963
+ prompt: input.promptContent ? { path: "PROMPT.md", content: input.promptContent } : void 0,
958
964
  webRoutes: webRoutes.length ? webRoutes : void 0,
959
965
  miniPages: miniPages.length ? miniPages : void 0,
960
966
  components: components.length ? components : void 0,
@@ -963,22 +969,22 @@ function buildAddonLlmGuidance(input) {
963
969
  npm: hasNpmDependencies(input.npm) ? input.npm : void 0
964
970
  };
965
971
  }
966
- async function readAddonSkillGuidance(extractedDir, manifest) {
967
- const hasSkillMemberAtRoot = manifest.members.some((member) => {
972
+ async function readAddonPrompt(extractedDir, manifest) {
973
+ const hasPromptMemberAtRoot = manifest.members.some((member) => {
968
974
  if (member.type !== "skill") {
969
975
  return false;
970
976
  }
971
977
  const sourcePath = resolveMemberSourcePath(member);
972
- return sourcePath === "SKILL.md";
978
+ return sourcePath === "PROMPT.md";
973
979
  });
974
- if (hasSkillMemberAtRoot) {
980
+ if (hasPromptMemberAtRoot) {
975
981
  return void 0;
976
982
  }
977
- const skillPath = path.join(extractedDir, "SKILL.md");
978
- if (!fs.existsSync(skillPath)) {
983
+ const promptPath = path.join(extractedDir, "PROMPT.md");
984
+ if (!fs.existsSync(promptPath)) {
979
985
  return void 0;
980
986
  }
981
- const content = (await promises$1.readFile(skillPath, "utf8")).trim();
987
+ const content = (await promises$1.readFile(promptPath, "utf8")).trim();
982
988
  return content || void 0;
983
989
  }
984
990
  function getAddonMetaPath(targetDir, addonName) {
@@ -1786,13 +1792,13 @@ async function materializeAddon(options) {
1786
1792
  await installPackageDependencies(targetDir);
1787
1793
  }
1788
1794
  const requirements = resolveInstallRequirements(plan.manifest);
1789
- const skillContent = await readAddonSkillGuidance(options.extractedDir, plan.manifest);
1795
+ const promptContent = await readAddonPrompt(options.extractedDir, plan.manifest);
1790
1796
  const llmGuidance = buildAddonLlmGuidance({
1791
1797
  operation: options.mode,
1792
1798
  meta,
1793
1799
  requirements,
1794
1800
  npm,
1795
- skillContent
1801
+ promptContent
1796
1802
  });
1797
1803
  return {
1798
1804
  meta,
@@ -1826,6 +1832,33 @@ function createOrganizationHeaders(organizationCode) {
1826
1832
  "x-organization-code": organizationCode
1827
1833
  };
1828
1834
  }
1835
+ function toAddonSearchResponse(response) {
1836
+ return {
1837
+ items: response.items.flatMap((addon2) => {
1838
+ const version = addon2.latestVersion;
1839
+ if (!version) {
1840
+ return [];
1841
+ }
1842
+ return [
1843
+ {
1844
+ name: addon2.name,
1845
+ version: version.version,
1846
+ installSpecifier: `${addon2.name}@${version.version}`,
1847
+ title: version.title,
1848
+ description: version.description,
1849
+ category: version.category,
1850
+ applicationTypes: version.applicationTypes,
1851
+ phases: version.phases,
1852
+ memberTypes: version.memberTypes,
1853
+ ...addon2.imageUrl ? { imageUrl: addon2.imageUrl } : {}
1854
+ }
1855
+ ];
1856
+ }),
1857
+ page: response.page,
1858
+ pageSize: response.pageSize,
1859
+ total: response.total
1860
+ };
1861
+ }
1829
1862
  function parseAddonSpecifier(specifier) {
1830
1863
  const trimmed = specifier.trim();
1831
1864
  if (!trimmed) {
@@ -1851,11 +1884,12 @@ async function searchAddons(registry, options) {
1851
1884
  if (options.scope) query.set("scope", options.scope);
1852
1885
  if (options.page) query.set("page", String(options.page));
1853
1886
  if (options.pageSize) query.set("pageSize", String(options.pageSize));
1854
- return await requestJson(registry, `/api/addons?${query.toString()}`, {
1887
+ const response = await requestJson(registry, `/api/addons?${query.toString()}`, {
1855
1888
  method: "GET",
1856
1889
  headers: createOrganizationHeaders(options.organizationCode),
1857
1890
  unwrapData: true
1858
1891
  });
1892
+ return toAddonSearchResponse(response);
1859
1893
  }
1860
1894
  async function getAddon(registry, name, organizationCode) {
1861
1895
  return await requestJson(registry, `/api/addons/${encodeURIComponent(name)}`, {
@@ -3444,12 +3478,6 @@ function renderAddonInstallResult(result, operation, options) {
3444
3478
  version: result.meta.version,
3445
3479
  applicationType: result.meta.applicationType
3446
3480
  },
3447
- files: {
3448
- written: result.writtenFiles,
3449
- removed: result.removedFiles
3450
- },
3451
- npm: Object.keys(result.npm.dependencies ?? {}).length ? result.npm : void 0,
3452
- missingRequirements: result.missingRequirements.envs?.length || result.missingRequirements.secrets?.length ? result.missingRequirements : void 0,
3453
3481
  llmGuidance: result.llmGuidance
3454
3482
  };
3455
3483
  if (options.json) {
@@ -3470,7 +3498,7 @@ function renderAddonInstallResult(result, operation, options) {
3470
3498
  if (result.llmGuidance.miniPages?.length) {
3471
3499
  lines.push("Next: wire mini pages from llmGuidance.miniPages.");
3472
3500
  }
3473
- if (output.missingRequirements) {
3501
+ if (result.missingRequirements.envs?.length || result.missingRequirements.secrets?.length) {
3474
3502
  lines.push("Next: configure missing env/secrets from llmGuidance.requirements.");
3475
3503
  }
3476
3504
  lines.push("Use --json for LLM-readable integration guidance.");