@amaster.ai/cli 1.1.54 → 1.1.56-beta.0
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 +4 -0
- package/dist/cli.cjs +604 -24
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +604 -24
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -966,6 +966,9 @@ async function tryDetectNearestApplicationType(startDir = process.cwd()) {
|
|
|
966
966
|
// src/marketplace/install.ts
|
|
967
967
|
var execFileAsync = promisify(execFile);
|
|
968
968
|
var ADDON_PROMPT_FILE_NAME = "PROMPT.md";
|
|
969
|
+
var DEFAULT_WORKFLOW_API_ENDPOINT = "http://workflow-api:5001";
|
|
970
|
+
var WORKFLOW_DATASET_ID_PATH = "/openapi/mcp/dataset-id";
|
|
971
|
+
var RAW_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
969
972
|
var AddonInstallConflictError = class extends Error {
|
|
970
973
|
constructor(input) {
|
|
971
974
|
super(`Addon ${input.operation} has ${input.conflicts.length} conflict(s)`);
|
|
@@ -1167,6 +1170,10 @@ function toImportSpecifier(targetPath) {
|
|
|
1167
1170
|
function toAssetImportSpecifier(targetPath) {
|
|
1168
1171
|
return targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
|
|
1169
1172
|
}
|
|
1173
|
+
function resolveComponentImportSpecifier(member) {
|
|
1174
|
+
const entryPath = member.targetPaths.find((targetPath) => /\/index\.[cm]?[jt]sx?$/.test(targetPath));
|
|
1175
|
+
return entryPath ? toImportSpecifier(entryPath) : member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : "";
|
|
1176
|
+
}
|
|
1170
1177
|
function resolveInstalledAddonDisplay(meta) {
|
|
1171
1178
|
const legacyMeta = meta;
|
|
1172
1179
|
return {
|
|
@@ -1194,7 +1201,7 @@ function buildAddonLlmGuidance(input) {
|
|
|
1194
1201
|
}));
|
|
1195
1202
|
const components = componentMembers.map((member) => ({
|
|
1196
1203
|
name: member.name,
|
|
1197
|
-
importFrom:
|
|
1204
|
+
importFrom: resolveComponentImportSpecifier(member)
|
|
1198
1205
|
}));
|
|
1199
1206
|
const functions = functionMembers.map((member) => ({
|
|
1200
1207
|
name: member.name,
|
|
@@ -1556,7 +1563,7 @@ async function buildInstallPlan(options) {
|
|
|
1556
1563
|
memberName: "install-requirements",
|
|
1557
1564
|
memberType: "settings",
|
|
1558
1565
|
patch: requirementsSettingsPatch,
|
|
1559
|
-
paths: flattenSettingsPatch(requirementsSettingsPatch)
|
|
1566
|
+
paths: flattenSettingsPatch(requirementsSettingsPatch, [], { sharedRequirement: true })
|
|
1560
1567
|
});
|
|
1561
1568
|
members.push({
|
|
1562
1569
|
name: "install-requirements",
|
|
@@ -1617,12 +1624,147 @@ function buildInstalledAddonMeta(options) {
|
|
|
1617
1624
|
async function ensureParentDirectory(filePath) {
|
|
1618
1625
|
await mkdir(dirname(filePath), { recursive: true });
|
|
1619
1626
|
}
|
|
1620
|
-
async function writePlannedFiles(targetDir, planFiles) {
|
|
1627
|
+
async function writePlannedFiles(targetDir, planFiles, contentByTargetPath = /* @__PURE__ */ new Map()) {
|
|
1621
1628
|
for (const file of planFiles) {
|
|
1622
1629
|
const absoluteTargetPath = ensurePathInsideTarget(targetDir, file.targetPath);
|
|
1623
1630
|
await ensureParentDirectory(absoluteTargetPath);
|
|
1624
|
-
|
|
1631
|
+
const content = contentByTargetPath.get(file.targetPath);
|
|
1632
|
+
if (content === void 0) {
|
|
1633
|
+
await copyFile(file.sourcePath, absoluteTargetPath);
|
|
1634
|
+
} else {
|
|
1635
|
+
await writeFile(absoluteTargetPath, content);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
function normalizeNonEmptyString(value) {
|
|
1640
|
+
const normalized = value?.trim();
|
|
1641
|
+
return normalized || void 0;
|
|
1642
|
+
}
|
|
1643
|
+
function isWorkflowYamlFile(file) {
|
|
1644
|
+
return file.memberType === "workflow" && /\.ya?ml$/i.test(file.targetPath);
|
|
1645
|
+
}
|
|
1646
|
+
function isDatasetIDPlaceholder(value) {
|
|
1647
|
+
const normalized = value.trim().toLowerCase().replace(/ /g, "");
|
|
1648
|
+
return [
|
|
1649
|
+
"",
|
|
1650
|
+
"__workflow_dataset_id__",
|
|
1651
|
+
"workflow_dataset_id",
|
|
1652
|
+
"workflow-dataset-id",
|
|
1653
|
+
"workflowdatasetid",
|
|
1654
|
+
"{{workflow_dataset_id}}",
|
|
1655
|
+
"${workflow_dataset_id}",
|
|
1656
|
+
"<workflow_dataset_id>",
|
|
1657
|
+
"__dataset_id__",
|
|
1658
|
+
"dataset_id",
|
|
1659
|
+
"{{dataset_id}}",
|
|
1660
|
+
"${dataset_id}",
|
|
1661
|
+
"<dataset_id>"
|
|
1662
|
+
].includes(normalized);
|
|
1663
|
+
}
|
|
1664
|
+
function datasetIDsCanBeAutoBound(value) {
|
|
1665
|
+
if (value === void 0 || value === null) {
|
|
1666
|
+
return true;
|
|
1667
|
+
}
|
|
1668
|
+
if (typeof value === "string") {
|
|
1669
|
+
return isDatasetIDPlaceholder(value);
|
|
1670
|
+
}
|
|
1671
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && isDatasetIDPlaceholder(item));
|
|
1672
|
+
}
|
|
1673
|
+
function bindKnowledgeRetrievalDatasetIDs(node, datasetID) {
|
|
1674
|
+
if (Array.isArray(node)) {
|
|
1675
|
+
return node.some((item) => bindKnowledgeRetrievalDatasetIDs(item, datasetID));
|
|
1676
|
+
}
|
|
1677
|
+
if (!isPlainObject(node)) {
|
|
1678
|
+
return false;
|
|
1679
|
+
}
|
|
1680
|
+
let changed = false;
|
|
1681
|
+
if (node.type === "knowledge-retrieval" && datasetIDsCanBeAutoBound(node.dataset_ids)) {
|
|
1682
|
+
node.dataset_ids = [datasetID];
|
|
1683
|
+
changed = true;
|
|
1684
|
+
}
|
|
1685
|
+
for (const value of Object.values(node)) {
|
|
1686
|
+
if (bindKnowledgeRetrievalDatasetIDs(value, datasetID)) {
|
|
1687
|
+
changed = true;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
return changed;
|
|
1691
|
+
}
|
|
1692
|
+
function resolveWorkflowDatasetBindingContext(options) {
|
|
1693
|
+
const sandboxOrganizationCode = normalizeNonEmptyString(process.env.WORKSPACE_ORG_CODE) ?? normalizeNonEmptyString(process.env.ORG_CODE);
|
|
1694
|
+
const organizationCode = normalizeNonEmptyString(options.organizationCode) ?? sandboxOrganizationCode;
|
|
1695
|
+
if (!organizationCode) {
|
|
1696
|
+
return null;
|
|
1697
|
+
}
|
|
1698
|
+
const configuredEndpoint = normalizeNonEmptyString(process.env.AMASTER_WORKFLOW_URL) ?? normalizeNonEmptyString(process.env.WORKFLOW_API_URL);
|
|
1699
|
+
if (!configuredEndpoint && !sandboxOrganizationCode) {
|
|
1700
|
+
return null;
|
|
1701
|
+
}
|
|
1702
|
+
return {
|
|
1703
|
+
organizationCode,
|
|
1704
|
+
endpoint: (configuredEndpoint ?? DEFAULT_WORKFLOW_API_ENDPOINT).replace(/\/+$/, "")
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
async function fetchWorkflowDSLDatasetID(context) {
|
|
1708
|
+
const endpoint = new URL(`${context.endpoint}${WORKFLOW_DATASET_ID_PATH}`);
|
|
1709
|
+
endpoint.searchParams.set("org_code", context.organizationCode);
|
|
1710
|
+
let response;
|
|
1711
|
+
try {
|
|
1712
|
+
response = await fetch(endpoint.toString(), { headers: { Accept: "application/json" } });
|
|
1713
|
+
} catch (error) {
|
|
1714
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1715
|
+
throw new Error(`Failed to resolve Workflow DSL dataset id: ${message}`);
|
|
1716
|
+
}
|
|
1717
|
+
if (!response.ok) {
|
|
1718
|
+
throw new Error(`Failed to resolve Workflow DSL dataset id: Workflow API returned ${response.status}`);
|
|
1719
|
+
}
|
|
1720
|
+
let payload;
|
|
1721
|
+
try {
|
|
1722
|
+
payload = await response.json();
|
|
1723
|
+
} catch {
|
|
1724
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: Workflow API returned invalid JSON");
|
|
1725
|
+
}
|
|
1726
|
+
const root = isPlainObject(payload) ? payload : {};
|
|
1727
|
+
const data = isPlainObject(root.data) ? root.data : {};
|
|
1728
|
+
const datasetID = typeof root.workflow_dsl_dataset_id === "string" ? root.workflow_dsl_dataset_id.trim() : typeof data.workflow_dsl_dataset_id === "string" ? data.workflow_dsl_dataset_id.trim() : "";
|
|
1729
|
+
if (!datasetID) {
|
|
1730
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: response is missing workflow_dsl_dataset_id");
|
|
1731
|
+
}
|
|
1732
|
+
if (RAW_UUID_PATTERN.test(datasetID)) {
|
|
1733
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: Workflow API returned a raw UUID");
|
|
1625
1734
|
}
|
|
1735
|
+
return datasetID;
|
|
1736
|
+
}
|
|
1737
|
+
async function prepareWorkflowDatasetBinding(options, plan) {
|
|
1738
|
+
const context = resolveWorkflowDatasetBindingContext(options);
|
|
1739
|
+
if (!context) {
|
|
1740
|
+
return null;
|
|
1741
|
+
}
|
|
1742
|
+
const candidates = [];
|
|
1743
|
+
for (const file of plan.files) {
|
|
1744
|
+
if (!isWorkflowYamlFile(file)) {
|
|
1745
|
+
continue;
|
|
1746
|
+
}
|
|
1747
|
+
const content = await readFile(file.sourcePath, "utf8");
|
|
1748
|
+
const parsed = YAML2.parse(content);
|
|
1749
|
+
if (bindKnowledgeRetrievalDatasetIDs(parsed, "__workflow_dataset_binding_probe__")) {
|
|
1750
|
+
candidates.push({ file, content });
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
if (!candidates.length) {
|
|
1754
|
+
return null;
|
|
1755
|
+
}
|
|
1756
|
+
const workflowDSLDatasetID = await fetchWorkflowDSLDatasetID(context);
|
|
1757
|
+
const contentByTargetPath = /* @__PURE__ */ new Map();
|
|
1758
|
+
for (const candidate of candidates) {
|
|
1759
|
+
const parsed = YAML2.parse(candidate.content);
|
|
1760
|
+
if (bindKnowledgeRetrievalDatasetIDs(parsed, workflowDSLDatasetID)) {
|
|
1761
|
+
contentByTargetPath.set(candidate.file.targetPath, YAML2.stringify(parsed));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
return {
|
|
1765
|
+
contentByTargetPath,
|
|
1766
|
+
boundFiles: [...contentByTargetPath.keys()]
|
|
1767
|
+
};
|
|
1626
1768
|
}
|
|
1627
1769
|
async function writeAddonPromptFile(targetDir, addonName, promptContent) {
|
|
1628
1770
|
const promptTargetPath = getAddonPromptTargetPath(addonName);
|
|
@@ -1651,18 +1793,21 @@ async function readYamlObject(filePath) {
|
|
|
1651
1793
|
}
|
|
1652
1794
|
return parsed;
|
|
1653
1795
|
}
|
|
1654
|
-
function flattenSettingsPatch(value, prefix = []) {
|
|
1796
|
+
function flattenSettingsPatch(value, prefix = [], options = {}) {
|
|
1655
1797
|
const paths = [];
|
|
1656
1798
|
for (const [key, child] of Object.entries(value)) {
|
|
1657
1799
|
const segments = prefix.concat(key);
|
|
1658
1800
|
if (isPlainObject(child)) {
|
|
1659
|
-
paths.push(...flattenSettingsPatch(child, segments));
|
|
1801
|
+
paths.push(...flattenSettingsPatch(child, segments, options));
|
|
1660
1802
|
continue;
|
|
1661
1803
|
}
|
|
1804
|
+
const path = segments.join(".");
|
|
1805
|
+
const merge = options.sharedRequirement ? { mergeStrategy: "shared-requirement" } : path === "rbac.permissions" && Array.isArray(child) ? { mergeStrategy: "append-unique" } : path === "rbac.roles" && Array.isArray(child) ? { mergeStrategy: "merge-by-key", mergeKey: "code" } : {};
|
|
1662
1806
|
paths.push({
|
|
1663
|
-
path
|
|
1807
|
+
path,
|
|
1664
1808
|
segments,
|
|
1665
|
-
value: child
|
|
1809
|
+
value: child,
|
|
1810
|
+
...merge
|
|
1666
1811
|
});
|
|
1667
1812
|
}
|
|
1668
1813
|
return paths;
|
|
@@ -1679,6 +1824,9 @@ function buildSettingsOwnershipMap(metas, excludeAddonName) {
|
|
|
1679
1824
|
}
|
|
1680
1825
|
for (const member of meta.members) {
|
|
1681
1826
|
for (const item of member.settings?.paths ?? []) {
|
|
1827
|
+
if (item.mergeStrategy) {
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1682
1830
|
ownership.set(`${item.targetPath}#${item.path}`, meta.name);
|
|
1683
1831
|
}
|
|
1684
1832
|
}
|
|
@@ -1693,7 +1841,9 @@ function listPlannedSettingPaths(settings) {
|
|
|
1693
1841
|
targetPath: item.targetPath,
|
|
1694
1842
|
path: settingPath.path,
|
|
1695
1843
|
segments: settingPath.segments,
|
|
1696
|
-
value: settingPath.value
|
|
1844
|
+
value: settingPath.value,
|
|
1845
|
+
mergeStrategy: settingPath.mergeStrategy,
|
|
1846
|
+
mergeKey: settingPath.mergeKey
|
|
1697
1847
|
}))
|
|
1698
1848
|
);
|
|
1699
1849
|
}
|
|
@@ -1704,6 +1854,226 @@ function getPlainYamlValue(document, segments) {
|
|
|
1704
1854
|
}
|
|
1705
1855
|
return value;
|
|
1706
1856
|
}
|
|
1857
|
+
function cloneSettingsValue(value) {
|
|
1858
|
+
if (Array.isArray(value)) {
|
|
1859
|
+
return value.map((item) => cloneSettingsValue(item));
|
|
1860
|
+
}
|
|
1861
|
+
if (isPlainObject(value)) {
|
|
1862
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, cloneSettingsValue(child)]));
|
|
1863
|
+
}
|
|
1864
|
+
return value;
|
|
1865
|
+
}
|
|
1866
|
+
function settingsValuesEqual(left, right) {
|
|
1867
|
+
return stableJsonStringify(left) === stableJsonStringify(right);
|
|
1868
|
+
}
|
|
1869
|
+
function isComposableSettingsPath(path) {
|
|
1870
|
+
return path === "rbac.permissions" || path === "rbac.roles" || path.startsWith("envMetadata.");
|
|
1871
|
+
}
|
|
1872
|
+
function mergeNestedSettingsObject(existing, incoming) {
|
|
1873
|
+
const merged = cloneSettingsValue(existing);
|
|
1874
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
1875
|
+
const current = merged[key];
|
|
1876
|
+
merged[key] = isPlainObject(current) && isPlainObject(value) ? mergeNestedSettingsObject(current, value) : cloneSettingsValue(value);
|
|
1877
|
+
}
|
|
1878
|
+
return merged;
|
|
1879
|
+
}
|
|
1880
|
+
function mergeArrayByKey(current, incoming, mergeKey) {
|
|
1881
|
+
if (!Array.isArray(incoming)) {
|
|
1882
|
+
throw new Error(`merge-by-key setting requires an array value`);
|
|
1883
|
+
}
|
|
1884
|
+
const merged = Array.isArray(current) ? current.map((item) => cloneSettingsValue(item)) : [];
|
|
1885
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1886
|
+
for (const [index, item] of merged.entries()) {
|
|
1887
|
+
if (isPlainObject(item) && item[mergeKey] !== void 0) {
|
|
1888
|
+
indexes.set(item[mergeKey], index);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
for (const item of incoming) {
|
|
1892
|
+
if (!isPlainObject(item) || item[mergeKey] === void 0) {
|
|
1893
|
+
throw new Error(`merge-by-key setting item must contain ${mergeKey}`);
|
|
1894
|
+
}
|
|
1895
|
+
const index = indexes.get(item[mergeKey]);
|
|
1896
|
+
if (index === void 0) {
|
|
1897
|
+
indexes.set(item[mergeKey], merged.length);
|
|
1898
|
+
merged.push(cloneSettingsValue(item));
|
|
1899
|
+
continue;
|
|
1900
|
+
}
|
|
1901
|
+
const existing = merged[index];
|
|
1902
|
+
if (!isPlainObject(existing)) {
|
|
1903
|
+
throw new Error(`merge-by-key setting contains a non-object item for ${String(item[mergeKey])}`);
|
|
1904
|
+
}
|
|
1905
|
+
const next = cloneSettingsValue(existing);
|
|
1906
|
+
for (const [field, value] of Object.entries(item)) {
|
|
1907
|
+
if (field === mergeKey) {
|
|
1908
|
+
continue;
|
|
1909
|
+
}
|
|
1910
|
+
const currentValue = next[field];
|
|
1911
|
+
if (isPlainObject(currentValue) && isPlainObject(value)) {
|
|
1912
|
+
next[field] = mergeNestedSettingsObject(currentValue, value);
|
|
1913
|
+
} else if (currentValue === void 0) {
|
|
1914
|
+
next[field] = cloneSettingsValue(value);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
merged[index] = next;
|
|
1918
|
+
}
|
|
1919
|
+
return merged;
|
|
1920
|
+
}
|
|
1921
|
+
function mergePlannedSettingValue(current, settingPath) {
|
|
1922
|
+
switch (settingPath.mergeStrategy) {
|
|
1923
|
+
case "append-unique": {
|
|
1924
|
+
if (!Array.isArray(settingPath.value)) {
|
|
1925
|
+
throw new Error(`append-unique setting requires an array value`);
|
|
1926
|
+
}
|
|
1927
|
+
const merged = Array.isArray(current) ? current.map((item) => cloneSettingsValue(item)) : [];
|
|
1928
|
+
for (const item of settingPath.value) {
|
|
1929
|
+
if (!merged.some((existing) => settingsValuesEqual(existing, item))) {
|
|
1930
|
+
merged.push(cloneSettingsValue(item));
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
return merged;
|
|
1934
|
+
}
|
|
1935
|
+
case "merge-by-key":
|
|
1936
|
+
return mergeArrayByKey(current, settingPath.value, settingPath.mergeKey ?? "code");
|
|
1937
|
+
case "shared-requirement": {
|
|
1938
|
+
if (current === void 0) {
|
|
1939
|
+
return cloneSettingsValue(settingPath.value);
|
|
1940
|
+
}
|
|
1941
|
+
if (settingPath.segments.at(-1) === "required") {
|
|
1942
|
+
return Boolean(current) || Boolean(settingPath.value);
|
|
1943
|
+
}
|
|
1944
|
+
return current;
|
|
1945
|
+
}
|
|
1946
|
+
default:
|
|
1947
|
+
return cloneSettingsValue(settingPath.value);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
function settingsValueContains(current, expected) {
|
|
1951
|
+
if (Array.isArray(expected)) {
|
|
1952
|
+
return Array.isArray(current) && expected.every(
|
|
1953
|
+
(item) => current.some((candidate) => settingsValueContains(candidate, item))
|
|
1954
|
+
);
|
|
1955
|
+
}
|
|
1956
|
+
if (isPlainObject(expected)) {
|
|
1957
|
+
return isPlainObject(current) && Object.entries(expected).every(
|
|
1958
|
+
([key, value]) => key in current && settingsValueContains(current[key], value)
|
|
1959
|
+
);
|
|
1960
|
+
}
|
|
1961
|
+
return settingsValuesEqual(current, expected);
|
|
1962
|
+
}
|
|
1963
|
+
function keyedArrayContributionPresent(current, contribution, previousValue, mergeKey) {
|
|
1964
|
+
if (!Array.isArray(current) || !Array.isArray(contribution)) {
|
|
1965
|
+
return false;
|
|
1966
|
+
}
|
|
1967
|
+
const previous = Array.isArray(previousValue) ? previousValue : [];
|
|
1968
|
+
for (const contributedItem of contribution) {
|
|
1969
|
+
if (!isPlainObject(contributedItem) || contributedItem[mergeKey] === void 0) {
|
|
1970
|
+
return false;
|
|
1971
|
+
}
|
|
1972
|
+
const currentItem = current.find(
|
|
1973
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
1974
|
+
);
|
|
1975
|
+
if (!isPlainObject(currentItem)) {
|
|
1976
|
+
return false;
|
|
1977
|
+
}
|
|
1978
|
+
const previousItem = previous.find(
|
|
1979
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
1980
|
+
);
|
|
1981
|
+
if (!isPlainObject(previousItem)) {
|
|
1982
|
+
if (!settingsValueContains(currentItem, contributedItem)) {
|
|
1983
|
+
return false;
|
|
1984
|
+
}
|
|
1985
|
+
continue;
|
|
1986
|
+
}
|
|
1987
|
+
for (const [field, value] of Object.entries(contributedItem)) {
|
|
1988
|
+
if (field === mergeKey) {
|
|
1989
|
+
continue;
|
|
1990
|
+
}
|
|
1991
|
+
if (isPlainObject(value)) {
|
|
1992
|
+
if (!settingsValueContains(currentItem[field], value)) {
|
|
1993
|
+
return false;
|
|
1994
|
+
}
|
|
1995
|
+
} else if (!(field in previousItem) && !settingsValuesEqual(currentItem[field], value)) {
|
|
1996
|
+
return false;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
return true;
|
|
2001
|
+
}
|
|
2002
|
+
function managedSettingContributionPresent(current, settingPath) {
|
|
2003
|
+
switch (settingPath.mergeStrategy) {
|
|
2004
|
+
case "append-unique":
|
|
2005
|
+
return settingsValueContains(current, settingPath.managedValue);
|
|
2006
|
+
case "merge-by-key":
|
|
2007
|
+
return keyedArrayContributionPresent(
|
|
2008
|
+
current,
|
|
2009
|
+
settingPath.managedValue,
|
|
2010
|
+
settingPath.previousValue,
|
|
2011
|
+
settingPath.mergeKey ?? "code"
|
|
2012
|
+
);
|
|
2013
|
+
case "shared-requirement":
|
|
2014
|
+
return true;
|
|
2015
|
+
default:
|
|
2016
|
+
return sha256Value(current) === settingPath.sha256;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
function plannedSettingContributionPresent(current, settingPath, previousValue) {
|
|
2020
|
+
switch (settingPath.mergeStrategy) {
|
|
2021
|
+
case "append-unique":
|
|
2022
|
+
return settingsValueContains(current, settingPath.value);
|
|
2023
|
+
case "merge-by-key":
|
|
2024
|
+
return keyedArrayContributionPresent(
|
|
2025
|
+
current,
|
|
2026
|
+
settingPath.value,
|
|
2027
|
+
previousValue,
|
|
2028
|
+
settingPath.mergeKey ?? "code"
|
|
2029
|
+
);
|
|
2030
|
+
case "shared-requirement":
|
|
2031
|
+
return sharedRequirementValuesCompatible(settingPath.path, current, settingPath.value);
|
|
2032
|
+
default:
|
|
2033
|
+
return settingsValuesEqual(current, settingPath.value);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
function sharedRequirementValuesCompatible(path, current, incoming) {
|
|
2037
|
+
const field = path.split(".").at(-1);
|
|
2038
|
+
if (current === void 0 || field === "required") {
|
|
2039
|
+
return true;
|
|
2040
|
+
}
|
|
2041
|
+
if (field === "category" || field === "label" || field === "description") {
|
|
2042
|
+
return true;
|
|
2043
|
+
}
|
|
2044
|
+
return settingsValuesEqual(current, incoming);
|
|
2045
|
+
}
|
|
2046
|
+
function findMergeByKeyConflict(current, incoming, mergeKey) {
|
|
2047
|
+
if (!Array.isArray(current) || !Array.isArray(incoming)) {
|
|
2048
|
+
return null;
|
|
2049
|
+
}
|
|
2050
|
+
for (const incomingItem of incoming) {
|
|
2051
|
+
if (!isPlainObject(incomingItem) || incomingItem[mergeKey] === void 0) {
|
|
2052
|
+
continue;
|
|
2053
|
+
}
|
|
2054
|
+
const currentItem = current.find(
|
|
2055
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], incomingItem[mergeKey])
|
|
2056
|
+
);
|
|
2057
|
+
if (!isPlainObject(currentItem)) {
|
|
2058
|
+
continue;
|
|
2059
|
+
}
|
|
2060
|
+
for (const [field, value] of Object.entries(incomingItem)) {
|
|
2061
|
+
if (field === mergeKey || !isPlainObject(value)) {
|
|
2062
|
+
continue;
|
|
2063
|
+
}
|
|
2064
|
+
const existing = currentItem[field];
|
|
2065
|
+
if (!isPlainObject(existing)) {
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
2069
|
+
if (nestedKey in existing && !settingsValuesEqual(existing[nestedKey], nestedValue)) {
|
|
2070
|
+
return { currentValue: existing[nestedKey], nextValue: nestedValue };
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
return null;
|
|
2076
|
+
}
|
|
1707
2077
|
function attachAppliedSettings(members, appliedSettings) {
|
|
1708
2078
|
return members.map((member) => {
|
|
1709
2079
|
const applied = appliedSettings.find((item) => item.memberName === member.name);
|
|
@@ -1729,13 +2099,17 @@ async function applyPlannedSettings(targetDir, settings) {
|
|
|
1729
2099
|
for (const settingPath of item.paths) {
|
|
1730
2100
|
const previousValueExists = document.hasIn(settingPath.segments);
|
|
1731
2101
|
const previousValue = previousValueExists ? getPlainYamlValue(document, settingPath.segments) : void 0;
|
|
1732
|
-
|
|
2102
|
+
const nextValue = mergePlannedSettingValue(previousValue, settingPath);
|
|
2103
|
+
document.setIn(settingPath.segments, nextValue);
|
|
1733
2104
|
pathMetas.push({
|
|
1734
2105
|
targetPath: item.targetPath,
|
|
1735
2106
|
path: settingPath.path,
|
|
1736
|
-
sha256: sha256Value(settingPath.value),
|
|
2107
|
+
sha256: sha256Value(settingPath.mergeStrategy ? settingPath.value : nextValue),
|
|
1737
2108
|
previousValueExists,
|
|
1738
|
-
previousValue
|
|
2109
|
+
previousValue,
|
|
2110
|
+
mergeStrategy: settingPath.mergeStrategy,
|
|
2111
|
+
mergeKey: settingPath.mergeKey,
|
|
2112
|
+
managedValue: settingPath.mergeStrategy ? cloneSettingsValue(settingPath.value) : void 0
|
|
1739
2113
|
});
|
|
1740
2114
|
}
|
|
1741
2115
|
await ensureParentDirectory(targetPath);
|
|
@@ -1752,7 +2126,124 @@ async function applyPlannedSettings(targetDir, settings) {
|
|
|
1752
2126
|
appliedSettings
|
|
1753
2127
|
};
|
|
1754
2128
|
}
|
|
1755
|
-
|
|
2129
|
+
function listOtherManagedSettingValues(metas, excludeAddonName, targetPath, path, mergeStrategy) {
|
|
2130
|
+
const values = [];
|
|
2131
|
+
for (const meta of metas) {
|
|
2132
|
+
if (meta.name === excludeAddonName) {
|
|
2133
|
+
continue;
|
|
2134
|
+
}
|
|
2135
|
+
for (const member of meta.members) {
|
|
2136
|
+
for (const settingPath of member.settings?.paths ?? []) {
|
|
2137
|
+
if (settingPath.targetPath === targetPath && settingPath.path === path && settingPath.mergeStrategy === mergeStrategy && settingPath.managedValue !== void 0) {
|
|
2138
|
+
values.push(settingPath.managedValue);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
return values;
|
|
2144
|
+
}
|
|
2145
|
+
function removeNestedSettingsContribution(current, contribution, previous, others) {
|
|
2146
|
+
const next = cloneSettingsValue(current);
|
|
2147
|
+
for (const [key, contributedValue] of Object.entries(contribution)) {
|
|
2148
|
+
const currentValue = next[key];
|
|
2149
|
+
const previousHasKey = previous ? key in previous : false;
|
|
2150
|
+
const otherValues = others.filter((item) => key in item).map((item) => item[key]);
|
|
2151
|
+
if (isPlainObject(contributedValue) && isPlainObject(currentValue)) {
|
|
2152
|
+
const previousObject = previousHasKey && isPlainObject(previous?.[key]) ? previous[key] : void 0;
|
|
2153
|
+
const otherObjects = otherValues.filter(isPlainObject);
|
|
2154
|
+
const nested = removeNestedSettingsContribution(
|
|
2155
|
+
currentValue,
|
|
2156
|
+
contributedValue,
|
|
2157
|
+
previousObject,
|
|
2158
|
+
otherObjects
|
|
2159
|
+
);
|
|
2160
|
+
if (!Object.keys(nested).length && !previousHasKey && !otherObjects.length) {
|
|
2161
|
+
delete next[key];
|
|
2162
|
+
} else {
|
|
2163
|
+
next[key] = nested;
|
|
2164
|
+
}
|
|
2165
|
+
continue;
|
|
2166
|
+
}
|
|
2167
|
+
if (otherValues.some((value) => settingsValuesEqual(value, contributedValue))) {
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
if (previousHasKey) {
|
|
2171
|
+
next[key] = cloneSettingsValue(previous?.[key]);
|
|
2172
|
+
} else if (settingsValuesEqual(currentValue, contributedValue)) {
|
|
2173
|
+
delete next[key];
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
return next;
|
|
2177
|
+
}
|
|
2178
|
+
function removeManagedSettingContribution(current, settingPath, otherManagedValues) {
|
|
2179
|
+
if (settingPath.mergeStrategy === "shared-requirement") {
|
|
2180
|
+
return current;
|
|
2181
|
+
}
|
|
2182
|
+
if (settingPath.mergeStrategy === "append-unique") {
|
|
2183
|
+
if (!Array.isArray(current) || !Array.isArray(settingPath.managedValue)) {
|
|
2184
|
+
return current;
|
|
2185
|
+
}
|
|
2186
|
+
const previous = Array.isArray(settingPath.previousValue) ? settingPath.previousValue : [];
|
|
2187
|
+
const otherItems = otherManagedValues.flatMap((value) => Array.isArray(value) ? value : []);
|
|
2188
|
+
return current.filter((item) => {
|
|
2189
|
+
const contributed = settingPath.managedValue;
|
|
2190
|
+
if (!contributed.some((value) => settingsValuesEqual(value, item))) {
|
|
2191
|
+
return true;
|
|
2192
|
+
}
|
|
2193
|
+
return previous.some((value) => settingsValuesEqual(value, item)) || otherItems.some((value) => settingsValuesEqual(value, item));
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
if (settingPath.mergeStrategy === "merge-by-key") {
|
|
2197
|
+
if (!Array.isArray(current) || !Array.isArray(settingPath.managedValue)) {
|
|
2198
|
+
return current;
|
|
2199
|
+
}
|
|
2200
|
+
const mergeKey = settingPath.mergeKey ?? "code";
|
|
2201
|
+
const previous = Array.isArray(settingPath.previousValue) ? settingPath.previousValue : [];
|
|
2202
|
+
const otherItems = otherManagedValues.flatMap((value) => Array.isArray(value) ? value : []);
|
|
2203
|
+
const next = current.map((item) => cloneSettingsValue(item));
|
|
2204
|
+
for (const contributedItem of settingPath.managedValue) {
|
|
2205
|
+
if (!isPlainObject(contributedItem) || contributedItem[mergeKey] === void 0) {
|
|
2206
|
+
continue;
|
|
2207
|
+
}
|
|
2208
|
+
const index = next.findIndex(
|
|
2209
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2210
|
+
);
|
|
2211
|
+
if (index < 0 || !isPlainObject(next[index])) {
|
|
2212
|
+
continue;
|
|
2213
|
+
}
|
|
2214
|
+
const currentItem = next[index];
|
|
2215
|
+
const previousItem = previous.find(
|
|
2216
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2217
|
+
);
|
|
2218
|
+
const matchingOtherItems = otherItems.filter(
|
|
2219
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2220
|
+
);
|
|
2221
|
+
if (!previousItem && !matchingOtherItems.length && settingsValuesEqual(currentItem, contributedItem)) {
|
|
2222
|
+
next.splice(index, 1);
|
|
2223
|
+
continue;
|
|
2224
|
+
}
|
|
2225
|
+
const updated = cloneSettingsValue(currentItem);
|
|
2226
|
+
for (const [field, contributedValue] of Object.entries(contributedItem)) {
|
|
2227
|
+
if (field === mergeKey || !isPlainObject(contributedValue) || !isPlainObject(updated[field])) {
|
|
2228
|
+
continue;
|
|
2229
|
+
}
|
|
2230
|
+
const previousObject = isPlainObject(previousItem) && isPlainObject(previousItem[field]) ? previousItem[field] : void 0;
|
|
2231
|
+
const otherObjects = matchingOtherItems.map((item) => item[field]).filter(isPlainObject);
|
|
2232
|
+
const nested = removeNestedSettingsContribution(
|
|
2233
|
+
updated[field],
|
|
2234
|
+
contributedValue,
|
|
2235
|
+
previousObject,
|
|
2236
|
+
otherObjects
|
|
2237
|
+
);
|
|
2238
|
+
updated[field] = nested;
|
|
2239
|
+
}
|
|
2240
|
+
next[index] = updated;
|
|
2241
|
+
}
|
|
2242
|
+
return next;
|
|
2243
|
+
}
|
|
2244
|
+
return settingPath.previousValueExists ? cloneSettingsValue(settingPath.previousValue) : void 0;
|
|
2245
|
+
}
|
|
2246
|
+
async function restoreObsoleteSettings(targetDir, previousMeta, nextSettings, existingMetas) {
|
|
1756
2247
|
if (!previousMeta) {
|
|
1757
2248
|
return [];
|
|
1758
2249
|
}
|
|
@@ -1772,12 +2263,30 @@ async function restoreObsoleteSettings(targetDir, previousMeta, nextSettings) {
|
|
|
1772
2263
|
};
|
|
1773
2264
|
for (const member of previousMeta.members) {
|
|
1774
2265
|
for (const settingPath of member.settings?.paths ?? []) {
|
|
1775
|
-
if (nextSettingKeys.has(`${settingPath.targetPath}#${settingPath.path}`)) {
|
|
2266
|
+
if (!settingPath.mergeStrategy && nextSettingKeys.has(`${settingPath.targetPath}#${settingPath.path}`)) {
|
|
2267
|
+
continue;
|
|
2268
|
+
}
|
|
2269
|
+
if (!settingPath.mergeStrategy && isComposableSettingsPath(settingPath.path)) {
|
|
1776
2270
|
continue;
|
|
1777
2271
|
}
|
|
1778
2272
|
const document = await getDocument(settingPath.targetPath);
|
|
1779
2273
|
const segments = settingPath.path.split(".");
|
|
1780
|
-
if (settingPath.
|
|
2274
|
+
if (settingPath.mergeStrategy) {
|
|
2275
|
+
const current = document.hasIn(segments) ? getPlainYamlValue(document, segments) : void 0;
|
|
2276
|
+
const otherManagedValues = listOtherManagedSettingValues(
|
|
2277
|
+
existingMetas,
|
|
2278
|
+
previousMeta.name,
|
|
2279
|
+
settingPath.targetPath,
|
|
2280
|
+
settingPath.path,
|
|
2281
|
+
settingPath.mergeStrategy
|
|
2282
|
+
);
|
|
2283
|
+
const restored = removeManagedSettingContribution(current, settingPath, otherManagedValues);
|
|
2284
|
+
if (restored === void 0) {
|
|
2285
|
+
document.deleteIn(segments);
|
|
2286
|
+
} else {
|
|
2287
|
+
document.setIn(segments, restored);
|
|
2288
|
+
}
|
|
2289
|
+
} else if (settingPath.previousValueExists) {
|
|
1781
2290
|
document.setIn(segments, settingPath.previousValue);
|
|
1782
2291
|
} else {
|
|
1783
2292
|
document.deleteIn(segments);
|
|
@@ -1869,6 +2378,16 @@ async function validateInstallConflicts(targetDir, plan, existingMetas) {
|
|
|
1869
2378
|
const settingsOwnership = buildSettingsOwnershipMap(existingMetas);
|
|
1870
2379
|
const conflicts = [];
|
|
1871
2380
|
const packageJson = await readPackageJson(targetDir);
|
|
2381
|
+
const settingsDocuments = /* @__PURE__ */ new Map();
|
|
2382
|
+
const getSettingsDocument = async (targetPath) => {
|
|
2383
|
+
const cached = settingsDocuments.get(targetPath);
|
|
2384
|
+
if (cached) {
|
|
2385
|
+
return cached;
|
|
2386
|
+
}
|
|
2387
|
+
const document = await readYamlDocument(ensurePathInsideTarget(targetDir, targetPath));
|
|
2388
|
+
settingsDocuments.set(targetPath, document);
|
|
2389
|
+
return document;
|
|
2390
|
+
};
|
|
1872
2391
|
for (const dependency of listNpmDependencies(resolveInstallNpm(plan.manifest))) {
|
|
1873
2392
|
const existing = findPackageDependency(packageJson, dependency.packageName);
|
|
1874
2393
|
if (existing && !isExistingNpmDependencyCompatible(existing, dependency.version)) {
|
|
@@ -1909,8 +2428,41 @@ async function validateInstallConflicts(targetDir, plan, existingMetas) {
|
|
|
1909
2428
|
}
|
|
1910
2429
|
}
|
|
1911
2430
|
for (const item of listPlannedSettingPaths(plan.settings)) {
|
|
2431
|
+
const document = await getSettingsDocument(item.targetPath);
|
|
2432
|
+
const currentValue = document.hasIn(item.segments) ? getPlainYamlValue(document, item.segments) : void 0;
|
|
2433
|
+
if (item.mergeStrategy === "shared-requirement" && !sharedRequirementValuesCompatible(item.path, currentValue, item.value)) {
|
|
2434
|
+
conflicts.push({
|
|
2435
|
+
kind: "setting_value_conflict",
|
|
2436
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2437
|
+
sourcePath: item.sourceRelativePath,
|
|
2438
|
+
memberName: item.memberName,
|
|
2439
|
+
memberType: "settings",
|
|
2440
|
+
settingPath: item.path,
|
|
2441
|
+
currentValue,
|
|
2442
|
+
nextValue: item.value,
|
|
2443
|
+
message: `${item.targetPath}#${item.path} has an incompatible shared requirement value`
|
|
2444
|
+
});
|
|
2445
|
+
continue;
|
|
2446
|
+
}
|
|
2447
|
+
if (item.mergeStrategy === "merge-by-key") {
|
|
2448
|
+
const conflict = findMergeByKeyConflict(currentValue, item.value, item.mergeKey ?? "code");
|
|
2449
|
+
if (conflict) {
|
|
2450
|
+
conflicts.push({
|
|
2451
|
+
kind: "setting_value_conflict",
|
|
2452
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2453
|
+
sourcePath: item.sourceRelativePath,
|
|
2454
|
+
memberName: item.memberName,
|
|
2455
|
+
memberType: "settings",
|
|
2456
|
+
settingPath: item.path,
|
|
2457
|
+
currentValue: conflict.currentValue,
|
|
2458
|
+
nextValue: conflict.nextValue,
|
|
2459
|
+
message: `${item.targetPath}#${item.path} contains an incompatible keyed setting value`
|
|
2460
|
+
});
|
|
2461
|
+
continue;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
1912
2464
|
const owner = settingsOwnership.get(`${item.targetPath}#${item.path}`);
|
|
1913
|
-
if (owner && owner !== plan.manifest.name) {
|
|
2465
|
+
if (!item.mergeStrategy && owner && owner !== plan.manifest.name) {
|
|
1914
2466
|
conflicts.push({
|
|
1915
2467
|
kind: "owned_by_other_addon",
|
|
1916
2468
|
path: `${item.targetPath}#${item.path}`,
|
|
@@ -2044,12 +2596,13 @@ async function validateUpgradeConflicts(targetDir, plan, existingMetas, previous
|
|
|
2044
2596
|
const segments = settingPath.path.split(".");
|
|
2045
2597
|
const currentValue = document.hasIn(segments) ? getPlainYamlValue(document, segments) : void 0;
|
|
2046
2598
|
const actualSha256 = sha256Value(currentValue);
|
|
2047
|
-
if (actualSha256 === settingPath.sha256) {
|
|
2048
|
-
continue;
|
|
2049
|
-
}
|
|
2050
2599
|
const settingKey = `${settingPath.targetPath}#${settingPath.path}`;
|
|
2051
2600
|
const isStillManaged = nextSettingKeys.has(settingKey);
|
|
2052
2601
|
const nextSetting = plannedSettingsByKey.get(settingKey);
|
|
2602
|
+
const contributionPresent = settingPath.mergeStrategy ? managedSettingContributionPresent(currentValue, settingPath) : nextSetting?.mergeStrategy ? plannedSettingContributionPresent(currentValue, nextSetting, settingPath.previousValue) : actualSha256 === settingPath.sha256;
|
|
2603
|
+
if (contributionPresent) {
|
|
2604
|
+
continue;
|
|
2605
|
+
}
|
|
2053
2606
|
conflicts.push({
|
|
2054
2607
|
kind: isStillManaged ? "managed_file_modified" : "obsolete_file_modified",
|
|
2055
2608
|
path: settingKey,
|
|
@@ -2067,8 +2620,24 @@ async function validateUpgradeConflicts(targetDir, plan, existingMetas, previous
|
|
|
2067
2620
|
}
|
|
2068
2621
|
}
|
|
2069
2622
|
for (const item of plannedSettings) {
|
|
2623
|
+
const document = await getSettingsDocument(item.targetPath);
|
|
2624
|
+
const currentValue = document.hasIn(item.segments) ? getPlainYamlValue(document, item.segments) : void 0;
|
|
2625
|
+
if (item.mergeStrategy === "shared-requirement" && !sharedRequirementValuesCompatible(item.path, currentValue, item.value)) {
|
|
2626
|
+
conflicts.push({
|
|
2627
|
+
kind: "setting_value_conflict",
|
|
2628
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2629
|
+
sourcePath: item.sourceRelativePath,
|
|
2630
|
+
memberName: item.memberName,
|
|
2631
|
+
memberType: "settings",
|
|
2632
|
+
settingPath: item.path,
|
|
2633
|
+
currentValue,
|
|
2634
|
+
nextValue: item.value,
|
|
2635
|
+
message: `${item.targetPath}#${item.path} has an incompatible shared requirement value`
|
|
2636
|
+
});
|
|
2637
|
+
continue;
|
|
2638
|
+
}
|
|
2070
2639
|
const owner = settingsOwnership.get(`${item.targetPath}#${item.path}`);
|
|
2071
|
-
if (owner) {
|
|
2640
|
+
if (!item.mergeStrategy && owner) {
|
|
2072
2641
|
conflicts.push({
|
|
2073
2642
|
kind: "owned_by_other_addon",
|
|
2074
2643
|
path: `${item.targetPath}#${item.path}`,
|
|
@@ -2135,11 +2704,17 @@ async function materializeAddon(options) {
|
|
|
2135
2704
|
} else if (previousMeta) {
|
|
2136
2705
|
await validateUpgradeConflicts(targetDir, plan, existingMetas, previousMeta);
|
|
2137
2706
|
}
|
|
2707
|
+
const workflowDatasetBinding = await prepareWorkflowDatasetBinding(options, plan);
|
|
2138
2708
|
const removedFiles = previousMeta ? await removeObsoleteFiles(targetDir, previousMeta, new Set(plan.files.map((file) => file.targetPath))) : [];
|
|
2139
|
-
const restoredSettingsFiles = await restoreObsoleteSettings(
|
|
2709
|
+
const restoredSettingsFiles = await restoreObsoleteSettings(
|
|
2710
|
+
targetDir,
|
|
2711
|
+
previousMeta,
|
|
2712
|
+
plan.settings,
|
|
2713
|
+
existingMetas
|
|
2714
|
+
);
|
|
2140
2715
|
const npm = resolveInstallNpm(plan.manifest);
|
|
2141
2716
|
const packageJsonFiles = await applyNpmDependencies(targetDir, npm);
|
|
2142
|
-
await writePlannedFiles(targetDir, plan.files);
|
|
2717
|
+
await writePlannedFiles(targetDir, plan.files, workflowDatasetBinding?.contentByTargetPath);
|
|
2143
2718
|
const settingsResult = await applyPlannedSettings(targetDir, plan.settings);
|
|
2144
2719
|
const promptContent = options.promptContent?.trim() || void 0;
|
|
2145
2720
|
const promptFiles = await writeAddonPromptFile(targetDir, plan.manifest.name, promptContent);
|
|
@@ -2181,7 +2756,8 @@ async function materializeAddon(options) {
|
|
|
2181
2756
|
requirements,
|
|
2182
2757
|
missingRequirements: buildMissingRequirements(requirements),
|
|
2183
2758
|
npm,
|
|
2184
|
-
llmGuidance
|
|
2759
|
+
llmGuidance,
|
|
2760
|
+
workflowDatasetBinding: workflowDatasetBinding ? { boundFiles: workflowDatasetBinding.boundFiles } : void 0
|
|
2185
2761
|
};
|
|
2186
2762
|
}
|
|
2187
2763
|
async function installAddonFromExtractedDirectory(options) {
|
|
@@ -3882,7 +4458,8 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3882
4458
|
version: result.meta.version,
|
|
3883
4459
|
applicationType: result.meta.applicationType
|
|
3884
4460
|
},
|
|
3885
|
-
llmGuidance: result.llmGuidance
|
|
4461
|
+
llmGuidance: result.llmGuidance,
|
|
4462
|
+
...result.workflowDatasetBinding ? { workflowDatasetBinding: result.workflowDatasetBinding } : {}
|
|
3886
4463
|
};
|
|
3887
4464
|
if (options.json) {
|
|
3888
4465
|
renderOutput(output, options);
|
|
@@ -3896,6 +4473,9 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3896
4473
|
if (result.removedFiles.length) {
|
|
3897
4474
|
lines.push(`Removed files: ${result.removedFiles.length}`);
|
|
3898
4475
|
}
|
|
4476
|
+
if (result.workflowDatasetBinding?.boundFiles.length) {
|
|
4477
|
+
lines.push(`Bound encrypted Workflow dataset IDs: ${result.workflowDatasetBinding.boundFiles.join(", ")}`);
|
|
4478
|
+
}
|
|
3899
4479
|
if (result.llmGuidance.webRoutes?.length) {
|
|
3900
4480
|
lines.push("Next: wire web routes from llmGuidance.webRoutes.");
|
|
3901
4481
|
}
|