@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/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import { promisify } from 'util';
14
14
  import YAML2 from 'yaml';
15
15
  import ts from 'typescript';
16
16
 
17
- var EXCLUDED_NAMES = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store"]);
17
+ var EXCLUDED_NAMES = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store", "PROMPT.md"]);
18
18
  function sha256(buffer) {
19
19
  return `sha256:${createHash("sha256").update(buffer).digest("hex")}`;
20
20
  }
@@ -942,24 +942,6 @@ function buildAddonLlmGuidance(input) {
942
942
  npm: hasNpmDependencies(input.npm) ? input.npm : void 0
943
943
  };
944
944
  }
945
- async function readAddonPrompt(extractedDir, manifest) {
946
- const hasPromptMemberAtRoot = manifest.members.some((member) => {
947
- if (member.type !== "skill") {
948
- return false;
949
- }
950
- const sourcePath = resolveMemberSourcePath(member);
951
- return sourcePath === "PROMPT.md";
952
- });
953
- if (hasPromptMemberAtRoot) {
954
- return void 0;
955
- }
956
- const promptPath = join(extractedDir, "PROMPT.md");
957
- if (!existsSync(promptPath)) {
958
- return void 0;
959
- }
960
- const content = (await readFile(promptPath, "utf8")).trim();
961
- return content || void 0;
962
- }
963
945
  function getAddonMetaPath(targetDir, addonName) {
964
946
  return join(targetDir, "src", "addons", addonName, "meta.json");
965
947
  }
@@ -1765,7 +1747,7 @@ async function materializeAddon(options) {
1765
1747
  await installPackageDependencies(targetDir);
1766
1748
  }
1767
1749
  const requirements = resolveInstallRequirements(plan.manifest);
1768
- const promptContent = await readAddonPrompt(options.extractedDir, plan.manifest);
1750
+ const promptContent = options.promptContent?.trim() || void 0;
1769
1751
  const llmGuidance = buildAddonLlmGuidance({
1770
1752
  operation: options.mode,
1771
1753
  meta,
@@ -1832,6 +1814,14 @@ function toAddonSearchResponse(response) {
1832
1814
  total: response.total
1833
1815
  };
1834
1816
  }
1817
+ async function readAddonPromptContent(sourceDir) {
1818
+ const promptPath = resolve(sourceDir, "PROMPT.md");
1819
+ if (!existsSync(promptPath)) {
1820
+ return void 0;
1821
+ }
1822
+ const content = (await readFile(promptPath, "utf8")).trim();
1823
+ return content || void 0;
1824
+ }
1835
1825
  function parseAddonSpecifier(specifier) {
1836
1826
  const trimmed = specifier.trim();
1837
1827
  if (!trimmed) {
@@ -1953,6 +1943,7 @@ async function publishAddon(options) {
1953
1943
  tempArchiveDir = dirname(packaged.archivePath);
1954
1944
  }
1955
1945
  const manifest = await loadAddonManifestFromDirectory(manifestDir);
1946
+ const promptContent = isArchive ? void 0 : await readAddonPromptContent(sourcePath);
1956
1947
  const digest = sha256(archiveBuffer);
1957
1948
  return await withAccessToken(options.registry, async (accessToken) => {
1958
1949
  const headers = {
@@ -1991,7 +1982,8 @@ async function publishAddon(options) {
1991
1982
  headers,
1992
1983
  body: {
1993
1984
  sessionId: session.sessionId,
1994
- ...options.scope ? { scope: options.scope } : {}
1985
+ ...options.scope ? { scope: options.scope } : {},
1986
+ ...promptContent ? { promptContent } : {}
1995
1987
  },
1996
1988
  unwrapData: true
1997
1989
  }
@@ -2055,6 +2047,7 @@ async function resolveInstallVersion(registry, name, requestedVersion, organizat
2055
2047
  async function installAddonFromRegistry(options) {
2056
2048
  const { name, version: requestedVersion } = parseAddonSpecifier(options.specifier);
2057
2049
  const version = await resolveInstallVersion(options.registry, name, requestedVersion, options.organizationCode);
2050
+ const versionDetail = await getAddonVersion(options.registry, name, version, options.organizationCode);
2058
2051
  const archiveBuffer = await downloadAddonArchiveBuffer(options.registry, name, version, options.organizationCode);
2059
2052
  const extractedDir = await extractAddonArchiveBuffer(archiveBuffer);
2060
2053
  try {
@@ -2065,7 +2058,8 @@ async function installAddonFromRegistry(options) {
2065
2058
  applicationType: options.applicationType,
2066
2059
  organizationCode: options.organizationCode,
2067
2060
  installParameters: options.installParameters,
2068
- installPackageDependencies: true
2061
+ installPackageDependencies: true,
2062
+ promptContent: versionDetail.promptContent ?? void 0
2069
2063
  });
2070
2064
  } finally {
2071
2065
  await removeTempDirectory(extractedDir).catch(() => void 0);
@@ -2074,6 +2068,7 @@ async function installAddonFromRegistry(options) {
2074
2068
  async function upgradeAddonFromRegistry(options) {
2075
2069
  const { name, version: requestedVersion } = parseAddonSpecifier(options.specifier);
2076
2070
  const version = await resolveInstallVersion(options.registry, name, requestedVersion, options.organizationCode);
2071
+ const versionDetail = await getAddonVersion(options.registry, name, version, options.organizationCode);
2077
2072
  const archiveBuffer = await downloadAddonArchiveBuffer(options.registry, name, version, options.organizationCode);
2078
2073
  const extractedDir = await extractAddonArchiveBuffer(archiveBuffer);
2079
2074
  try {
@@ -2084,7 +2079,8 @@ async function upgradeAddonFromRegistry(options) {
2084
2079
  applicationType: options.applicationType,
2085
2080
  organizationCode: options.organizationCode,
2086
2081
  installParameters: options.installParameters,
2087
- installPackageDependencies: true
2082
+ installPackageDependencies: true,
2083
+ promptContent: versionDetail.promptContent ?? void 0
2088
2084
  });
2089
2085
  } finally {
2090
2086
  await removeTempDirectory(extractedDir).catch(() => void 0);