@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 +5 -3
- package/dist/cli.cjs +50 -22
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +50 -22
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -883,6 +883,13 @@ function hasInstallRequirements(requirements) {
|
|
|
883
883
|
function hasNpmDependencies(npm) {
|
|
884
884
|
return Boolean(Object.keys(npm.dependencies ?? {}).length);
|
|
885
885
|
}
|
|
886
|
+
function removePathExtension(path) {
|
|
887
|
+
return path.replace(/\.[^/.]+$/, "");
|
|
888
|
+
}
|
|
889
|
+
function toImportSpecifier(targetPath) {
|
|
890
|
+
const normalized = targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
|
|
891
|
+
return removePathExtension(normalized).replace(/\/index$/, "");
|
|
892
|
+
}
|
|
886
893
|
function buildAddonLlmGuidance(input) {
|
|
887
894
|
const pageMembers = input.meta.members.filter((member) => member.type === "page");
|
|
888
895
|
const componentMembers = input.meta.members.filter((member) => member.type === "component");
|
|
@@ -901,16 +908,15 @@ function buildAddonLlmGuidance(input) {
|
|
|
901
908
|
}));
|
|
902
909
|
const components = componentMembers.map((member) => ({
|
|
903
910
|
name: member.name,
|
|
904
|
-
importFrom: member.targetPaths[0]
|
|
905
|
-
targetPaths: member.targetPaths
|
|
911
|
+
importFrom: member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : ""
|
|
906
912
|
}));
|
|
907
913
|
const settings = settingsMembers.map((member) => ({
|
|
908
914
|
targetPath: member.settings?.targetPath || member.targetPaths[0] || "",
|
|
909
915
|
paths: member.settings?.paths.map((item) => item.path) || []
|
|
910
916
|
}));
|
|
911
917
|
const instructions = [
|
|
912
|
-
|
|
913
|
-
"Do not
|
|
918
|
+
"Use the installed Addon files in the host application's existing pages, components, routes, dialogs, or preview areas.",
|
|
919
|
+
"Do not reinstall to complete integration; edit application source files directly."
|
|
914
920
|
];
|
|
915
921
|
if (pageMembers.length > 0) {
|
|
916
922
|
instructions.push("Wire the installed page members into the application's existing routing/configuration style.");
|
|
@@ -927,7 +933,7 @@ function buildAddonLlmGuidance(input) {
|
|
|
927
933
|
return {
|
|
928
934
|
summary: input.meta.manifest.description || input.meta.manifest.title || `Installed addon ${input.meta.name}@${input.meta.version}.`,
|
|
929
935
|
instructions,
|
|
930
|
-
|
|
936
|
+
prompt: input.promptContent ? { path: "PROMPT.md", content: input.promptContent } : void 0,
|
|
931
937
|
webRoutes: webRoutes.length ? webRoutes : void 0,
|
|
932
938
|
miniPages: miniPages.length ? miniPages : void 0,
|
|
933
939
|
components: components.length ? components : void 0,
|
|
@@ -936,22 +942,22 @@ function buildAddonLlmGuidance(input) {
|
|
|
936
942
|
npm: hasNpmDependencies(input.npm) ? input.npm : void 0
|
|
937
943
|
};
|
|
938
944
|
}
|
|
939
|
-
async function
|
|
940
|
-
const
|
|
945
|
+
async function readAddonPrompt(extractedDir, manifest) {
|
|
946
|
+
const hasPromptMemberAtRoot = manifest.members.some((member) => {
|
|
941
947
|
if (member.type !== "skill") {
|
|
942
948
|
return false;
|
|
943
949
|
}
|
|
944
950
|
const sourcePath = resolveMemberSourcePath(member);
|
|
945
|
-
return sourcePath === "
|
|
951
|
+
return sourcePath === "PROMPT.md";
|
|
946
952
|
});
|
|
947
|
-
if (
|
|
953
|
+
if (hasPromptMemberAtRoot) {
|
|
948
954
|
return void 0;
|
|
949
955
|
}
|
|
950
|
-
const
|
|
951
|
-
if (!existsSync(
|
|
956
|
+
const promptPath = join(extractedDir, "PROMPT.md");
|
|
957
|
+
if (!existsSync(promptPath)) {
|
|
952
958
|
return void 0;
|
|
953
959
|
}
|
|
954
|
-
const content = (await readFile(
|
|
960
|
+
const content = (await readFile(promptPath, "utf8")).trim();
|
|
955
961
|
return content || void 0;
|
|
956
962
|
}
|
|
957
963
|
function getAddonMetaPath(targetDir, addonName) {
|
|
@@ -1759,13 +1765,13 @@ async function materializeAddon(options) {
|
|
|
1759
1765
|
await installPackageDependencies(targetDir);
|
|
1760
1766
|
}
|
|
1761
1767
|
const requirements = resolveInstallRequirements(plan.manifest);
|
|
1762
|
-
const
|
|
1768
|
+
const promptContent = await readAddonPrompt(options.extractedDir, plan.manifest);
|
|
1763
1769
|
const llmGuidance = buildAddonLlmGuidance({
|
|
1764
1770
|
operation: options.mode,
|
|
1765
1771
|
meta,
|
|
1766
1772
|
requirements,
|
|
1767
1773
|
npm,
|
|
1768
|
-
|
|
1774
|
+
promptContent
|
|
1769
1775
|
});
|
|
1770
1776
|
return {
|
|
1771
1777
|
meta,
|
|
@@ -1799,6 +1805,33 @@ function createOrganizationHeaders(organizationCode) {
|
|
|
1799
1805
|
"x-organization-code": organizationCode
|
|
1800
1806
|
};
|
|
1801
1807
|
}
|
|
1808
|
+
function toAddonSearchResponse(response) {
|
|
1809
|
+
return {
|
|
1810
|
+
items: response.items.flatMap((addon2) => {
|
|
1811
|
+
const version = addon2.latestVersion;
|
|
1812
|
+
if (!version) {
|
|
1813
|
+
return [];
|
|
1814
|
+
}
|
|
1815
|
+
return [
|
|
1816
|
+
{
|
|
1817
|
+
name: addon2.name,
|
|
1818
|
+
version: version.version,
|
|
1819
|
+
installSpecifier: `${addon2.name}@${version.version}`,
|
|
1820
|
+
title: version.title,
|
|
1821
|
+
description: version.description,
|
|
1822
|
+
category: version.category,
|
|
1823
|
+
applicationTypes: version.applicationTypes,
|
|
1824
|
+
phases: version.phases,
|
|
1825
|
+
memberTypes: version.memberTypes,
|
|
1826
|
+
...addon2.imageUrl ? { imageUrl: addon2.imageUrl } : {}
|
|
1827
|
+
}
|
|
1828
|
+
];
|
|
1829
|
+
}),
|
|
1830
|
+
page: response.page,
|
|
1831
|
+
pageSize: response.pageSize,
|
|
1832
|
+
total: response.total
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1802
1835
|
function parseAddonSpecifier(specifier) {
|
|
1803
1836
|
const trimmed = specifier.trim();
|
|
1804
1837
|
if (!trimmed) {
|
|
@@ -1824,11 +1857,12 @@ async function searchAddons(registry, options) {
|
|
|
1824
1857
|
if (options.scope) query.set("scope", options.scope);
|
|
1825
1858
|
if (options.page) query.set("page", String(options.page));
|
|
1826
1859
|
if (options.pageSize) query.set("pageSize", String(options.pageSize));
|
|
1827
|
-
|
|
1860
|
+
const response = await requestJson(registry, `/api/addons?${query.toString()}`, {
|
|
1828
1861
|
method: "GET",
|
|
1829
1862
|
headers: createOrganizationHeaders(options.organizationCode),
|
|
1830
1863
|
unwrapData: true
|
|
1831
1864
|
});
|
|
1865
|
+
return toAddonSearchResponse(response);
|
|
1832
1866
|
}
|
|
1833
1867
|
async function getAddon(registry, name, organizationCode) {
|
|
1834
1868
|
return await requestJson(registry, `/api/addons/${encodeURIComponent(name)}`, {
|
|
@@ -3417,12 +3451,6 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3417
3451
|
version: result.meta.version,
|
|
3418
3452
|
applicationType: result.meta.applicationType
|
|
3419
3453
|
},
|
|
3420
|
-
files: {
|
|
3421
|
-
written: result.writtenFiles,
|
|
3422
|
-
removed: result.removedFiles
|
|
3423
|
-
},
|
|
3424
|
-
npm: Object.keys(result.npm.dependencies ?? {}).length ? result.npm : void 0,
|
|
3425
|
-
missingRequirements: result.missingRequirements.envs?.length || result.missingRequirements.secrets?.length ? result.missingRequirements : void 0,
|
|
3426
3454
|
llmGuidance: result.llmGuidance
|
|
3427
3455
|
};
|
|
3428
3456
|
if (options.json) {
|
|
@@ -3443,7 +3471,7 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3443
3471
|
if (result.llmGuidance.miniPages?.length) {
|
|
3444
3472
|
lines.push("Next: wire mini pages from llmGuidance.miniPages.");
|
|
3445
3473
|
}
|
|
3446
|
-
if (
|
|
3474
|
+
if (result.missingRequirements.envs?.length || result.missingRequirements.secrets?.length) {
|
|
3447
3475
|
lines.push("Next: configure missing env/secrets from llmGuidance.requirements.");
|
|
3448
3476
|
}
|
|
3449
3477
|
lines.push("Use --json for LLM-readable integration guidance.");
|