@amaster.ai/cli 1.1.33 → 1.1.34

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
@@ -150,7 +150,7 @@ Addon 可在 `addon.json` 中声明安装后的运行配置要求:
150
150
  显式接入指导:
151
151
 
152
152
  - Addon 包根目录可以放 `PROMPT.md`
153
- - `PROMPT.md` 不会安装到应用工程,只会在安装/升级结果的 `llmGuidance.prompt` 中返回给大模型
153
+ - `PROMPT.md` 不会进入安装包,也不会安装到应用工程;发布时会作为版本提示词元数据保存,并在安装/升级结果的 `llmGuidance.prompt` 中返回给大模型
154
154
  - 如果 Addon 本身就是一个 skill 资源,应在 `addon.json.members` 中显式声明 `type: "skill"`;普通 Addon 的根 `PROMPT.md` 只作为模型指导
155
155
 
156
156
  升级策略:
package/dist/cli.cjs CHANGED
@@ -41,7 +41,7 @@ var tar__namespace = /*#__PURE__*/_interopNamespace(tar);
41
41
  var YAML2__default = /*#__PURE__*/_interopDefault(YAML2);
42
42
  var ts__default = /*#__PURE__*/_interopDefault(ts);
43
43
 
44
- var EXCLUDED_NAMES = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store"]);
44
+ var EXCLUDED_NAMES = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store", "PROMPT.md"]);
45
45
  function sha256(buffer) {
46
46
  return `sha256:${crypto.createHash("sha256").update(buffer).digest("hex")}`;
47
47
  }
@@ -969,24 +969,6 @@ function buildAddonLlmGuidance(input) {
969
969
  npm: hasNpmDependencies(input.npm) ? input.npm : void 0
970
970
  };
971
971
  }
972
- async function readAddonPrompt(extractedDir, manifest) {
973
- const hasPromptMemberAtRoot = manifest.members.some((member) => {
974
- if (member.type !== "skill") {
975
- return false;
976
- }
977
- const sourcePath = resolveMemberSourcePath(member);
978
- return sourcePath === "PROMPT.md";
979
- });
980
- if (hasPromptMemberAtRoot) {
981
- return void 0;
982
- }
983
- const promptPath = path.join(extractedDir, "PROMPT.md");
984
- if (!fs.existsSync(promptPath)) {
985
- return void 0;
986
- }
987
- const content = (await promises$1.readFile(promptPath, "utf8")).trim();
988
- return content || void 0;
989
- }
990
972
  function getAddonMetaPath(targetDir, addonName) {
991
973
  return path.join(targetDir, "src", "addons", addonName, "meta.json");
992
974
  }
@@ -1792,7 +1774,7 @@ async function materializeAddon(options) {
1792
1774
  await installPackageDependencies(targetDir);
1793
1775
  }
1794
1776
  const requirements = resolveInstallRequirements(plan.manifest);
1795
- const promptContent = await readAddonPrompt(options.extractedDir, plan.manifest);
1777
+ const promptContent = options.promptContent?.trim() || void 0;
1796
1778
  const llmGuidance = buildAddonLlmGuidance({
1797
1779
  operation: options.mode,
1798
1780
  meta,
@@ -1859,6 +1841,14 @@ function toAddonSearchResponse(response) {
1859
1841
  total: response.total
1860
1842
  };
1861
1843
  }
1844
+ async function readAddonPromptContent(sourceDir) {
1845
+ const promptPath = path.resolve(sourceDir, "PROMPT.md");
1846
+ if (!fs.existsSync(promptPath)) {
1847
+ return void 0;
1848
+ }
1849
+ const content = (await promises$1.readFile(promptPath, "utf8")).trim();
1850
+ return content || void 0;
1851
+ }
1862
1852
  function parseAddonSpecifier(specifier) {
1863
1853
  const trimmed = specifier.trim();
1864
1854
  if (!trimmed) {
@@ -1980,6 +1970,7 @@ async function publishAddon(options) {
1980
1970
  tempArchiveDir = path.dirname(packaged.archivePath);
1981
1971
  }
1982
1972
  const manifest = await loadAddonManifestFromDirectory(manifestDir);
1973
+ const promptContent = isArchive ? void 0 : await readAddonPromptContent(sourcePath);
1983
1974
  const digest = sha256(archiveBuffer);
1984
1975
  return await withAccessToken(options.registry, async (accessToken) => {
1985
1976
  const headers = {
@@ -2018,7 +2009,8 @@ async function publishAddon(options) {
2018
2009
  headers,
2019
2010
  body: {
2020
2011
  sessionId: session.sessionId,
2021
- ...options.scope ? { scope: options.scope } : {}
2012
+ ...options.scope ? { scope: options.scope } : {},
2013
+ ...promptContent ? { promptContent } : {}
2022
2014
  },
2023
2015
  unwrapData: true
2024
2016
  }
@@ -2082,6 +2074,7 @@ async function resolveInstallVersion(registry, name, requestedVersion, organizat
2082
2074
  async function installAddonFromRegistry(options) {
2083
2075
  const { name, version: requestedVersion } = parseAddonSpecifier(options.specifier);
2084
2076
  const version = await resolveInstallVersion(options.registry, name, requestedVersion, options.organizationCode);
2077
+ const versionDetail = await getAddonVersion(options.registry, name, version, options.organizationCode);
2085
2078
  const archiveBuffer = await downloadAddonArchiveBuffer(options.registry, name, version, options.organizationCode);
2086
2079
  const extractedDir = await extractAddonArchiveBuffer(archiveBuffer);
2087
2080
  try {
@@ -2092,7 +2085,8 @@ async function installAddonFromRegistry(options) {
2092
2085
  applicationType: options.applicationType,
2093
2086
  organizationCode: options.organizationCode,
2094
2087
  installParameters: options.installParameters,
2095
- installPackageDependencies: true
2088
+ installPackageDependencies: true,
2089
+ promptContent: versionDetail.promptContent ?? void 0
2096
2090
  });
2097
2091
  } finally {
2098
2092
  await removeTempDirectory(extractedDir).catch(() => void 0);
@@ -2101,6 +2095,7 @@ async function installAddonFromRegistry(options) {
2101
2095
  async function upgradeAddonFromRegistry(options) {
2102
2096
  const { name, version: requestedVersion } = parseAddonSpecifier(options.specifier);
2103
2097
  const version = await resolveInstallVersion(options.registry, name, requestedVersion, options.organizationCode);
2098
+ const versionDetail = await getAddonVersion(options.registry, name, version, options.organizationCode);
2104
2099
  const archiveBuffer = await downloadAddonArchiveBuffer(options.registry, name, version, options.organizationCode);
2105
2100
  const extractedDir = await extractAddonArchiveBuffer(archiveBuffer);
2106
2101
  try {
@@ -2111,7 +2106,8 @@ async function upgradeAddonFromRegistry(options) {
2111
2106
  applicationType: options.applicationType,
2112
2107
  organizationCode: options.organizationCode,
2113
2108
  installParameters: options.installParameters,
2114
- installPackageDependencies: true
2109
+ installPackageDependencies: true,
2110
+ promptContent: versionDetail.promptContent ?? void 0
2115
2111
  });
2116
2112
  } finally {
2117
2113
  await removeTempDirectory(extractedDir).catch(() => void 0);