@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.cjs
CHANGED
|
@@ -993,6 +993,9 @@ async function tryDetectNearestApplicationType(startDir = process.cwd()) {
|
|
|
993
993
|
// src/marketplace/install.ts
|
|
994
994
|
var execFileAsync = util.promisify(child_process.execFile);
|
|
995
995
|
var ADDON_PROMPT_FILE_NAME = "PROMPT.md";
|
|
996
|
+
var DEFAULT_WORKFLOW_API_ENDPOINT = "http://workflow-api:5001";
|
|
997
|
+
var WORKFLOW_DATASET_ID_PATH = "/openapi/mcp/dataset-id";
|
|
998
|
+
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;
|
|
996
999
|
var AddonInstallConflictError = class extends Error {
|
|
997
1000
|
constructor(input) {
|
|
998
1001
|
super(`Addon ${input.operation} has ${input.conflicts.length} conflict(s)`);
|
|
@@ -1194,6 +1197,10 @@ function toImportSpecifier(targetPath) {
|
|
|
1194
1197
|
function toAssetImportSpecifier(targetPath) {
|
|
1195
1198
|
return targetPath.replace(/\\/g, "/").replace(/^src\//, "@/");
|
|
1196
1199
|
}
|
|
1200
|
+
function resolveComponentImportSpecifier(member) {
|
|
1201
|
+
const entryPath = member.targetPaths.find((targetPath) => /\/index\.[cm]?[jt]sx?$/.test(targetPath));
|
|
1202
|
+
return entryPath ? toImportSpecifier(entryPath) : member.targetPaths[0] ? toImportSpecifier(member.targetPaths[0]) : "";
|
|
1203
|
+
}
|
|
1197
1204
|
function resolveInstalledAddonDisplay(meta) {
|
|
1198
1205
|
const legacyMeta = meta;
|
|
1199
1206
|
return {
|
|
@@ -1221,7 +1228,7 @@ function buildAddonLlmGuidance(input) {
|
|
|
1221
1228
|
}));
|
|
1222
1229
|
const components = componentMembers.map((member) => ({
|
|
1223
1230
|
name: member.name,
|
|
1224
|
-
importFrom:
|
|
1231
|
+
importFrom: resolveComponentImportSpecifier(member)
|
|
1225
1232
|
}));
|
|
1226
1233
|
const functions = functionMembers.map((member) => ({
|
|
1227
1234
|
name: member.name,
|
|
@@ -1583,7 +1590,7 @@ async function buildInstallPlan(options) {
|
|
|
1583
1590
|
memberName: "install-requirements",
|
|
1584
1591
|
memberType: "settings",
|
|
1585
1592
|
patch: requirementsSettingsPatch,
|
|
1586
|
-
paths: flattenSettingsPatch(requirementsSettingsPatch)
|
|
1593
|
+
paths: flattenSettingsPatch(requirementsSettingsPatch, [], { sharedRequirement: true })
|
|
1587
1594
|
});
|
|
1588
1595
|
members.push({
|
|
1589
1596
|
name: "install-requirements",
|
|
@@ -1644,12 +1651,147 @@ function buildInstalledAddonMeta(options) {
|
|
|
1644
1651
|
async function ensureParentDirectory(filePath) {
|
|
1645
1652
|
await promises$1.mkdir(path.dirname(filePath), { recursive: true });
|
|
1646
1653
|
}
|
|
1647
|
-
async function writePlannedFiles(targetDir, planFiles) {
|
|
1654
|
+
async function writePlannedFiles(targetDir, planFiles, contentByTargetPath = /* @__PURE__ */ new Map()) {
|
|
1648
1655
|
for (const file of planFiles) {
|
|
1649
1656
|
const absoluteTargetPath = ensurePathInsideTarget(targetDir, file.targetPath);
|
|
1650
1657
|
await ensureParentDirectory(absoluteTargetPath);
|
|
1651
|
-
|
|
1658
|
+
const content = contentByTargetPath.get(file.targetPath);
|
|
1659
|
+
if (content === void 0) {
|
|
1660
|
+
await promises$1.copyFile(file.sourcePath, absoluteTargetPath);
|
|
1661
|
+
} else {
|
|
1662
|
+
await promises$1.writeFile(absoluteTargetPath, content);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
function normalizeNonEmptyString(value) {
|
|
1667
|
+
const normalized = value?.trim();
|
|
1668
|
+
return normalized || void 0;
|
|
1669
|
+
}
|
|
1670
|
+
function isWorkflowYamlFile(file) {
|
|
1671
|
+
return file.memberType === "workflow" && /\.ya?ml$/i.test(file.targetPath);
|
|
1672
|
+
}
|
|
1673
|
+
function isDatasetIDPlaceholder(value) {
|
|
1674
|
+
const normalized = value.trim().toLowerCase().replace(/ /g, "");
|
|
1675
|
+
return [
|
|
1676
|
+
"",
|
|
1677
|
+
"__workflow_dataset_id__",
|
|
1678
|
+
"workflow_dataset_id",
|
|
1679
|
+
"workflow-dataset-id",
|
|
1680
|
+
"workflowdatasetid",
|
|
1681
|
+
"{{workflow_dataset_id}}",
|
|
1682
|
+
"${workflow_dataset_id}",
|
|
1683
|
+
"<workflow_dataset_id>",
|
|
1684
|
+
"__dataset_id__",
|
|
1685
|
+
"dataset_id",
|
|
1686
|
+
"{{dataset_id}}",
|
|
1687
|
+
"${dataset_id}",
|
|
1688
|
+
"<dataset_id>"
|
|
1689
|
+
].includes(normalized);
|
|
1690
|
+
}
|
|
1691
|
+
function datasetIDsCanBeAutoBound(value) {
|
|
1692
|
+
if (value === void 0 || value === null) {
|
|
1693
|
+
return true;
|
|
1694
|
+
}
|
|
1695
|
+
if (typeof value === "string") {
|
|
1696
|
+
return isDatasetIDPlaceholder(value);
|
|
1697
|
+
}
|
|
1698
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && isDatasetIDPlaceholder(item));
|
|
1699
|
+
}
|
|
1700
|
+
function bindKnowledgeRetrievalDatasetIDs(node, datasetID) {
|
|
1701
|
+
if (Array.isArray(node)) {
|
|
1702
|
+
return node.some((item) => bindKnowledgeRetrievalDatasetIDs(item, datasetID));
|
|
1703
|
+
}
|
|
1704
|
+
if (!isPlainObject(node)) {
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
let changed = false;
|
|
1708
|
+
if (node.type === "knowledge-retrieval" && datasetIDsCanBeAutoBound(node.dataset_ids)) {
|
|
1709
|
+
node.dataset_ids = [datasetID];
|
|
1710
|
+
changed = true;
|
|
1711
|
+
}
|
|
1712
|
+
for (const value of Object.values(node)) {
|
|
1713
|
+
if (bindKnowledgeRetrievalDatasetIDs(value, datasetID)) {
|
|
1714
|
+
changed = true;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
return changed;
|
|
1718
|
+
}
|
|
1719
|
+
function resolveWorkflowDatasetBindingContext(options) {
|
|
1720
|
+
const sandboxOrganizationCode = normalizeNonEmptyString(process.env.WORKSPACE_ORG_CODE) ?? normalizeNonEmptyString(process.env.ORG_CODE);
|
|
1721
|
+
const organizationCode = normalizeNonEmptyString(options.organizationCode) ?? sandboxOrganizationCode;
|
|
1722
|
+
if (!organizationCode) {
|
|
1723
|
+
return null;
|
|
1724
|
+
}
|
|
1725
|
+
const configuredEndpoint = normalizeNonEmptyString(process.env.AMASTER_WORKFLOW_URL) ?? normalizeNonEmptyString(process.env.WORKFLOW_API_URL);
|
|
1726
|
+
if (!configuredEndpoint && !sandboxOrganizationCode) {
|
|
1727
|
+
return null;
|
|
1728
|
+
}
|
|
1729
|
+
return {
|
|
1730
|
+
organizationCode,
|
|
1731
|
+
endpoint: (configuredEndpoint ?? DEFAULT_WORKFLOW_API_ENDPOINT).replace(/\/+$/, "")
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
async function fetchWorkflowDSLDatasetID(context) {
|
|
1735
|
+
const endpoint = new URL(`${context.endpoint}${WORKFLOW_DATASET_ID_PATH}`);
|
|
1736
|
+
endpoint.searchParams.set("org_code", context.organizationCode);
|
|
1737
|
+
let response;
|
|
1738
|
+
try {
|
|
1739
|
+
response = await fetch(endpoint.toString(), { headers: { Accept: "application/json" } });
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1742
|
+
throw new Error(`Failed to resolve Workflow DSL dataset id: ${message}`);
|
|
1743
|
+
}
|
|
1744
|
+
if (!response.ok) {
|
|
1745
|
+
throw new Error(`Failed to resolve Workflow DSL dataset id: Workflow API returned ${response.status}`);
|
|
1746
|
+
}
|
|
1747
|
+
let payload;
|
|
1748
|
+
try {
|
|
1749
|
+
payload = await response.json();
|
|
1750
|
+
} catch {
|
|
1751
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: Workflow API returned invalid JSON");
|
|
1752
|
+
}
|
|
1753
|
+
const root = isPlainObject(payload) ? payload : {};
|
|
1754
|
+
const data = isPlainObject(root.data) ? root.data : {};
|
|
1755
|
+
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() : "";
|
|
1756
|
+
if (!datasetID) {
|
|
1757
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: response is missing workflow_dsl_dataset_id");
|
|
1758
|
+
}
|
|
1759
|
+
if (RAW_UUID_PATTERN.test(datasetID)) {
|
|
1760
|
+
throw new Error("Failed to resolve Workflow DSL dataset id: Workflow API returned a raw UUID");
|
|
1652
1761
|
}
|
|
1762
|
+
return datasetID;
|
|
1763
|
+
}
|
|
1764
|
+
async function prepareWorkflowDatasetBinding(options, plan) {
|
|
1765
|
+
const context = resolveWorkflowDatasetBindingContext(options);
|
|
1766
|
+
if (!context) {
|
|
1767
|
+
return null;
|
|
1768
|
+
}
|
|
1769
|
+
const candidates = [];
|
|
1770
|
+
for (const file of plan.files) {
|
|
1771
|
+
if (!isWorkflowYamlFile(file)) {
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
const content = await promises$1.readFile(file.sourcePath, "utf8");
|
|
1775
|
+
const parsed = YAML2__default.default.parse(content);
|
|
1776
|
+
if (bindKnowledgeRetrievalDatasetIDs(parsed, "__workflow_dataset_binding_probe__")) {
|
|
1777
|
+
candidates.push({ file, content });
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
if (!candidates.length) {
|
|
1781
|
+
return null;
|
|
1782
|
+
}
|
|
1783
|
+
const workflowDSLDatasetID = await fetchWorkflowDSLDatasetID(context);
|
|
1784
|
+
const contentByTargetPath = /* @__PURE__ */ new Map();
|
|
1785
|
+
for (const candidate of candidates) {
|
|
1786
|
+
const parsed = YAML2__default.default.parse(candidate.content);
|
|
1787
|
+
if (bindKnowledgeRetrievalDatasetIDs(parsed, workflowDSLDatasetID)) {
|
|
1788
|
+
contentByTargetPath.set(candidate.file.targetPath, YAML2__default.default.stringify(parsed));
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
return {
|
|
1792
|
+
contentByTargetPath,
|
|
1793
|
+
boundFiles: [...contentByTargetPath.keys()]
|
|
1794
|
+
};
|
|
1653
1795
|
}
|
|
1654
1796
|
async function writeAddonPromptFile(targetDir, addonName, promptContent) {
|
|
1655
1797
|
const promptTargetPath = getAddonPromptTargetPath(addonName);
|
|
@@ -1678,18 +1820,21 @@ async function readYamlObject(filePath) {
|
|
|
1678
1820
|
}
|
|
1679
1821
|
return parsed;
|
|
1680
1822
|
}
|
|
1681
|
-
function flattenSettingsPatch(value, prefix = []) {
|
|
1823
|
+
function flattenSettingsPatch(value, prefix = [], options = {}) {
|
|
1682
1824
|
const paths = [];
|
|
1683
1825
|
for (const [key, child] of Object.entries(value)) {
|
|
1684
1826
|
const segments = prefix.concat(key);
|
|
1685
1827
|
if (isPlainObject(child)) {
|
|
1686
|
-
paths.push(...flattenSettingsPatch(child, segments));
|
|
1828
|
+
paths.push(...flattenSettingsPatch(child, segments, options));
|
|
1687
1829
|
continue;
|
|
1688
1830
|
}
|
|
1831
|
+
const path = segments.join(".");
|
|
1832
|
+
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" } : {};
|
|
1689
1833
|
paths.push({
|
|
1690
|
-
path
|
|
1834
|
+
path,
|
|
1691
1835
|
segments,
|
|
1692
|
-
value: child
|
|
1836
|
+
value: child,
|
|
1837
|
+
...merge
|
|
1693
1838
|
});
|
|
1694
1839
|
}
|
|
1695
1840
|
return paths;
|
|
@@ -1706,6 +1851,9 @@ function buildSettingsOwnershipMap(metas, excludeAddonName) {
|
|
|
1706
1851
|
}
|
|
1707
1852
|
for (const member of meta.members) {
|
|
1708
1853
|
for (const item of member.settings?.paths ?? []) {
|
|
1854
|
+
if (item.mergeStrategy) {
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1709
1857
|
ownership.set(`${item.targetPath}#${item.path}`, meta.name);
|
|
1710
1858
|
}
|
|
1711
1859
|
}
|
|
@@ -1720,7 +1868,9 @@ function listPlannedSettingPaths(settings) {
|
|
|
1720
1868
|
targetPath: item.targetPath,
|
|
1721
1869
|
path: settingPath.path,
|
|
1722
1870
|
segments: settingPath.segments,
|
|
1723
|
-
value: settingPath.value
|
|
1871
|
+
value: settingPath.value,
|
|
1872
|
+
mergeStrategy: settingPath.mergeStrategy,
|
|
1873
|
+
mergeKey: settingPath.mergeKey
|
|
1724
1874
|
}))
|
|
1725
1875
|
);
|
|
1726
1876
|
}
|
|
@@ -1731,6 +1881,226 @@ function getPlainYamlValue(document, segments) {
|
|
|
1731
1881
|
}
|
|
1732
1882
|
return value;
|
|
1733
1883
|
}
|
|
1884
|
+
function cloneSettingsValue(value) {
|
|
1885
|
+
if (Array.isArray(value)) {
|
|
1886
|
+
return value.map((item) => cloneSettingsValue(item));
|
|
1887
|
+
}
|
|
1888
|
+
if (isPlainObject(value)) {
|
|
1889
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, cloneSettingsValue(child)]));
|
|
1890
|
+
}
|
|
1891
|
+
return value;
|
|
1892
|
+
}
|
|
1893
|
+
function settingsValuesEqual(left, right) {
|
|
1894
|
+
return stableJsonStringify(left) === stableJsonStringify(right);
|
|
1895
|
+
}
|
|
1896
|
+
function isComposableSettingsPath(path) {
|
|
1897
|
+
return path === "rbac.permissions" || path === "rbac.roles" || path.startsWith("envMetadata.");
|
|
1898
|
+
}
|
|
1899
|
+
function mergeNestedSettingsObject(existing, incoming) {
|
|
1900
|
+
const merged = cloneSettingsValue(existing);
|
|
1901
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
1902
|
+
const current = merged[key];
|
|
1903
|
+
merged[key] = isPlainObject(current) && isPlainObject(value) ? mergeNestedSettingsObject(current, value) : cloneSettingsValue(value);
|
|
1904
|
+
}
|
|
1905
|
+
return merged;
|
|
1906
|
+
}
|
|
1907
|
+
function mergeArrayByKey(current, incoming, mergeKey) {
|
|
1908
|
+
if (!Array.isArray(incoming)) {
|
|
1909
|
+
throw new Error(`merge-by-key setting requires an array value`);
|
|
1910
|
+
}
|
|
1911
|
+
const merged = Array.isArray(current) ? current.map((item) => cloneSettingsValue(item)) : [];
|
|
1912
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1913
|
+
for (const [index, item] of merged.entries()) {
|
|
1914
|
+
if (isPlainObject(item) && item[mergeKey] !== void 0) {
|
|
1915
|
+
indexes.set(item[mergeKey], index);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
for (const item of incoming) {
|
|
1919
|
+
if (!isPlainObject(item) || item[mergeKey] === void 0) {
|
|
1920
|
+
throw new Error(`merge-by-key setting item must contain ${mergeKey}`);
|
|
1921
|
+
}
|
|
1922
|
+
const index = indexes.get(item[mergeKey]);
|
|
1923
|
+
if (index === void 0) {
|
|
1924
|
+
indexes.set(item[mergeKey], merged.length);
|
|
1925
|
+
merged.push(cloneSettingsValue(item));
|
|
1926
|
+
continue;
|
|
1927
|
+
}
|
|
1928
|
+
const existing = merged[index];
|
|
1929
|
+
if (!isPlainObject(existing)) {
|
|
1930
|
+
throw new Error(`merge-by-key setting contains a non-object item for ${String(item[mergeKey])}`);
|
|
1931
|
+
}
|
|
1932
|
+
const next = cloneSettingsValue(existing);
|
|
1933
|
+
for (const [field, value] of Object.entries(item)) {
|
|
1934
|
+
if (field === mergeKey) {
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
const currentValue = next[field];
|
|
1938
|
+
if (isPlainObject(currentValue) && isPlainObject(value)) {
|
|
1939
|
+
next[field] = mergeNestedSettingsObject(currentValue, value);
|
|
1940
|
+
} else if (currentValue === void 0) {
|
|
1941
|
+
next[field] = cloneSettingsValue(value);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
merged[index] = next;
|
|
1945
|
+
}
|
|
1946
|
+
return merged;
|
|
1947
|
+
}
|
|
1948
|
+
function mergePlannedSettingValue(current, settingPath) {
|
|
1949
|
+
switch (settingPath.mergeStrategy) {
|
|
1950
|
+
case "append-unique": {
|
|
1951
|
+
if (!Array.isArray(settingPath.value)) {
|
|
1952
|
+
throw new Error(`append-unique setting requires an array value`);
|
|
1953
|
+
}
|
|
1954
|
+
const merged = Array.isArray(current) ? current.map((item) => cloneSettingsValue(item)) : [];
|
|
1955
|
+
for (const item of settingPath.value) {
|
|
1956
|
+
if (!merged.some((existing) => settingsValuesEqual(existing, item))) {
|
|
1957
|
+
merged.push(cloneSettingsValue(item));
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
return merged;
|
|
1961
|
+
}
|
|
1962
|
+
case "merge-by-key":
|
|
1963
|
+
return mergeArrayByKey(current, settingPath.value, settingPath.mergeKey ?? "code");
|
|
1964
|
+
case "shared-requirement": {
|
|
1965
|
+
if (current === void 0) {
|
|
1966
|
+
return cloneSettingsValue(settingPath.value);
|
|
1967
|
+
}
|
|
1968
|
+
if (settingPath.segments.at(-1) === "required") {
|
|
1969
|
+
return Boolean(current) || Boolean(settingPath.value);
|
|
1970
|
+
}
|
|
1971
|
+
return current;
|
|
1972
|
+
}
|
|
1973
|
+
default:
|
|
1974
|
+
return cloneSettingsValue(settingPath.value);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
function settingsValueContains(current, expected) {
|
|
1978
|
+
if (Array.isArray(expected)) {
|
|
1979
|
+
return Array.isArray(current) && expected.every(
|
|
1980
|
+
(item) => current.some((candidate) => settingsValueContains(candidate, item))
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
if (isPlainObject(expected)) {
|
|
1984
|
+
return isPlainObject(current) && Object.entries(expected).every(
|
|
1985
|
+
([key, value]) => key in current && settingsValueContains(current[key], value)
|
|
1986
|
+
);
|
|
1987
|
+
}
|
|
1988
|
+
return settingsValuesEqual(current, expected);
|
|
1989
|
+
}
|
|
1990
|
+
function keyedArrayContributionPresent(current, contribution, previousValue, mergeKey) {
|
|
1991
|
+
if (!Array.isArray(current) || !Array.isArray(contribution)) {
|
|
1992
|
+
return false;
|
|
1993
|
+
}
|
|
1994
|
+
const previous = Array.isArray(previousValue) ? previousValue : [];
|
|
1995
|
+
for (const contributedItem of contribution) {
|
|
1996
|
+
if (!isPlainObject(contributedItem) || contributedItem[mergeKey] === void 0) {
|
|
1997
|
+
return false;
|
|
1998
|
+
}
|
|
1999
|
+
const currentItem = current.find(
|
|
2000
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2001
|
+
);
|
|
2002
|
+
if (!isPlainObject(currentItem)) {
|
|
2003
|
+
return false;
|
|
2004
|
+
}
|
|
2005
|
+
const previousItem = previous.find(
|
|
2006
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2007
|
+
);
|
|
2008
|
+
if (!isPlainObject(previousItem)) {
|
|
2009
|
+
if (!settingsValueContains(currentItem, contributedItem)) {
|
|
2010
|
+
return false;
|
|
2011
|
+
}
|
|
2012
|
+
continue;
|
|
2013
|
+
}
|
|
2014
|
+
for (const [field, value] of Object.entries(contributedItem)) {
|
|
2015
|
+
if (field === mergeKey) {
|
|
2016
|
+
continue;
|
|
2017
|
+
}
|
|
2018
|
+
if (isPlainObject(value)) {
|
|
2019
|
+
if (!settingsValueContains(currentItem[field], value)) {
|
|
2020
|
+
return false;
|
|
2021
|
+
}
|
|
2022
|
+
} else if (!(field in previousItem) && !settingsValuesEqual(currentItem[field], value)) {
|
|
2023
|
+
return false;
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
return true;
|
|
2028
|
+
}
|
|
2029
|
+
function managedSettingContributionPresent(current, settingPath) {
|
|
2030
|
+
switch (settingPath.mergeStrategy) {
|
|
2031
|
+
case "append-unique":
|
|
2032
|
+
return settingsValueContains(current, settingPath.managedValue);
|
|
2033
|
+
case "merge-by-key":
|
|
2034
|
+
return keyedArrayContributionPresent(
|
|
2035
|
+
current,
|
|
2036
|
+
settingPath.managedValue,
|
|
2037
|
+
settingPath.previousValue,
|
|
2038
|
+
settingPath.mergeKey ?? "code"
|
|
2039
|
+
);
|
|
2040
|
+
case "shared-requirement":
|
|
2041
|
+
return true;
|
|
2042
|
+
default:
|
|
2043
|
+
return sha256Value(current) === settingPath.sha256;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
function plannedSettingContributionPresent(current, settingPath, previousValue) {
|
|
2047
|
+
switch (settingPath.mergeStrategy) {
|
|
2048
|
+
case "append-unique":
|
|
2049
|
+
return settingsValueContains(current, settingPath.value);
|
|
2050
|
+
case "merge-by-key":
|
|
2051
|
+
return keyedArrayContributionPresent(
|
|
2052
|
+
current,
|
|
2053
|
+
settingPath.value,
|
|
2054
|
+
previousValue,
|
|
2055
|
+
settingPath.mergeKey ?? "code"
|
|
2056
|
+
);
|
|
2057
|
+
case "shared-requirement":
|
|
2058
|
+
return sharedRequirementValuesCompatible(settingPath.path, current, settingPath.value);
|
|
2059
|
+
default:
|
|
2060
|
+
return settingsValuesEqual(current, settingPath.value);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
function sharedRequirementValuesCompatible(path, current, incoming) {
|
|
2064
|
+
const field = path.split(".").at(-1);
|
|
2065
|
+
if (current === void 0 || field === "required") {
|
|
2066
|
+
return true;
|
|
2067
|
+
}
|
|
2068
|
+
if (field === "category" || field === "label" || field === "description") {
|
|
2069
|
+
return true;
|
|
2070
|
+
}
|
|
2071
|
+
return settingsValuesEqual(current, incoming);
|
|
2072
|
+
}
|
|
2073
|
+
function findMergeByKeyConflict(current, incoming, mergeKey) {
|
|
2074
|
+
if (!Array.isArray(current) || !Array.isArray(incoming)) {
|
|
2075
|
+
return null;
|
|
2076
|
+
}
|
|
2077
|
+
for (const incomingItem of incoming) {
|
|
2078
|
+
if (!isPlainObject(incomingItem) || incomingItem[mergeKey] === void 0) {
|
|
2079
|
+
continue;
|
|
2080
|
+
}
|
|
2081
|
+
const currentItem = current.find(
|
|
2082
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], incomingItem[mergeKey])
|
|
2083
|
+
);
|
|
2084
|
+
if (!isPlainObject(currentItem)) {
|
|
2085
|
+
continue;
|
|
2086
|
+
}
|
|
2087
|
+
for (const [field, value] of Object.entries(incomingItem)) {
|
|
2088
|
+
if (field === mergeKey || !isPlainObject(value)) {
|
|
2089
|
+
continue;
|
|
2090
|
+
}
|
|
2091
|
+
const existing = currentItem[field];
|
|
2092
|
+
if (!isPlainObject(existing)) {
|
|
2093
|
+
continue;
|
|
2094
|
+
}
|
|
2095
|
+
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
2096
|
+
if (nestedKey in existing && !settingsValuesEqual(existing[nestedKey], nestedValue)) {
|
|
2097
|
+
return { currentValue: existing[nestedKey], nextValue: nestedValue };
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
return null;
|
|
2103
|
+
}
|
|
1734
2104
|
function attachAppliedSettings(members, appliedSettings) {
|
|
1735
2105
|
return members.map((member) => {
|
|
1736
2106
|
const applied = appliedSettings.find((item) => item.memberName === member.name);
|
|
@@ -1756,13 +2126,17 @@ async function applyPlannedSettings(targetDir, settings) {
|
|
|
1756
2126
|
for (const settingPath of item.paths) {
|
|
1757
2127
|
const previousValueExists = document.hasIn(settingPath.segments);
|
|
1758
2128
|
const previousValue = previousValueExists ? getPlainYamlValue(document, settingPath.segments) : void 0;
|
|
1759
|
-
|
|
2129
|
+
const nextValue = mergePlannedSettingValue(previousValue, settingPath);
|
|
2130
|
+
document.setIn(settingPath.segments, nextValue);
|
|
1760
2131
|
pathMetas.push({
|
|
1761
2132
|
targetPath: item.targetPath,
|
|
1762
2133
|
path: settingPath.path,
|
|
1763
|
-
sha256: sha256Value(settingPath.value),
|
|
2134
|
+
sha256: sha256Value(settingPath.mergeStrategy ? settingPath.value : nextValue),
|
|
1764
2135
|
previousValueExists,
|
|
1765
|
-
previousValue
|
|
2136
|
+
previousValue,
|
|
2137
|
+
mergeStrategy: settingPath.mergeStrategy,
|
|
2138
|
+
mergeKey: settingPath.mergeKey,
|
|
2139
|
+
managedValue: settingPath.mergeStrategy ? cloneSettingsValue(settingPath.value) : void 0
|
|
1766
2140
|
});
|
|
1767
2141
|
}
|
|
1768
2142
|
await ensureParentDirectory(targetPath);
|
|
@@ -1779,7 +2153,124 @@ async function applyPlannedSettings(targetDir, settings) {
|
|
|
1779
2153
|
appliedSettings
|
|
1780
2154
|
};
|
|
1781
2155
|
}
|
|
1782
|
-
|
|
2156
|
+
function listOtherManagedSettingValues(metas, excludeAddonName, targetPath, path, mergeStrategy) {
|
|
2157
|
+
const values = [];
|
|
2158
|
+
for (const meta of metas) {
|
|
2159
|
+
if (meta.name === excludeAddonName) {
|
|
2160
|
+
continue;
|
|
2161
|
+
}
|
|
2162
|
+
for (const member of meta.members) {
|
|
2163
|
+
for (const settingPath of member.settings?.paths ?? []) {
|
|
2164
|
+
if (settingPath.targetPath === targetPath && settingPath.path === path && settingPath.mergeStrategy === mergeStrategy && settingPath.managedValue !== void 0) {
|
|
2165
|
+
values.push(settingPath.managedValue);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
return values;
|
|
2171
|
+
}
|
|
2172
|
+
function removeNestedSettingsContribution(current, contribution, previous, others) {
|
|
2173
|
+
const next = cloneSettingsValue(current);
|
|
2174
|
+
for (const [key, contributedValue] of Object.entries(contribution)) {
|
|
2175
|
+
const currentValue = next[key];
|
|
2176
|
+
const previousHasKey = previous ? key in previous : false;
|
|
2177
|
+
const otherValues = others.filter((item) => key in item).map((item) => item[key]);
|
|
2178
|
+
if (isPlainObject(contributedValue) && isPlainObject(currentValue)) {
|
|
2179
|
+
const previousObject = previousHasKey && isPlainObject(previous?.[key]) ? previous[key] : void 0;
|
|
2180
|
+
const otherObjects = otherValues.filter(isPlainObject);
|
|
2181
|
+
const nested = removeNestedSettingsContribution(
|
|
2182
|
+
currentValue,
|
|
2183
|
+
contributedValue,
|
|
2184
|
+
previousObject,
|
|
2185
|
+
otherObjects
|
|
2186
|
+
);
|
|
2187
|
+
if (!Object.keys(nested).length && !previousHasKey && !otherObjects.length) {
|
|
2188
|
+
delete next[key];
|
|
2189
|
+
} else {
|
|
2190
|
+
next[key] = nested;
|
|
2191
|
+
}
|
|
2192
|
+
continue;
|
|
2193
|
+
}
|
|
2194
|
+
if (otherValues.some((value) => settingsValuesEqual(value, contributedValue))) {
|
|
2195
|
+
continue;
|
|
2196
|
+
}
|
|
2197
|
+
if (previousHasKey) {
|
|
2198
|
+
next[key] = cloneSettingsValue(previous?.[key]);
|
|
2199
|
+
} else if (settingsValuesEqual(currentValue, contributedValue)) {
|
|
2200
|
+
delete next[key];
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
return next;
|
|
2204
|
+
}
|
|
2205
|
+
function removeManagedSettingContribution(current, settingPath, otherManagedValues) {
|
|
2206
|
+
if (settingPath.mergeStrategy === "shared-requirement") {
|
|
2207
|
+
return current;
|
|
2208
|
+
}
|
|
2209
|
+
if (settingPath.mergeStrategy === "append-unique") {
|
|
2210
|
+
if (!Array.isArray(current) || !Array.isArray(settingPath.managedValue)) {
|
|
2211
|
+
return current;
|
|
2212
|
+
}
|
|
2213
|
+
const previous = Array.isArray(settingPath.previousValue) ? settingPath.previousValue : [];
|
|
2214
|
+
const otherItems = otherManagedValues.flatMap((value) => Array.isArray(value) ? value : []);
|
|
2215
|
+
return current.filter((item) => {
|
|
2216
|
+
const contributed = settingPath.managedValue;
|
|
2217
|
+
if (!contributed.some((value) => settingsValuesEqual(value, item))) {
|
|
2218
|
+
return true;
|
|
2219
|
+
}
|
|
2220
|
+
return previous.some((value) => settingsValuesEqual(value, item)) || otherItems.some((value) => settingsValuesEqual(value, item));
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
if (settingPath.mergeStrategy === "merge-by-key") {
|
|
2224
|
+
if (!Array.isArray(current) || !Array.isArray(settingPath.managedValue)) {
|
|
2225
|
+
return current;
|
|
2226
|
+
}
|
|
2227
|
+
const mergeKey = settingPath.mergeKey ?? "code";
|
|
2228
|
+
const previous = Array.isArray(settingPath.previousValue) ? settingPath.previousValue : [];
|
|
2229
|
+
const otherItems = otherManagedValues.flatMap((value) => Array.isArray(value) ? value : []);
|
|
2230
|
+
const next = current.map((item) => cloneSettingsValue(item));
|
|
2231
|
+
for (const contributedItem of settingPath.managedValue) {
|
|
2232
|
+
if (!isPlainObject(contributedItem) || contributedItem[mergeKey] === void 0) {
|
|
2233
|
+
continue;
|
|
2234
|
+
}
|
|
2235
|
+
const index = next.findIndex(
|
|
2236
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2237
|
+
);
|
|
2238
|
+
if (index < 0 || !isPlainObject(next[index])) {
|
|
2239
|
+
continue;
|
|
2240
|
+
}
|
|
2241
|
+
const currentItem = next[index];
|
|
2242
|
+
const previousItem = previous.find(
|
|
2243
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2244
|
+
);
|
|
2245
|
+
const matchingOtherItems = otherItems.filter(
|
|
2246
|
+
(item) => isPlainObject(item) && settingsValuesEqual(item[mergeKey], contributedItem[mergeKey])
|
|
2247
|
+
);
|
|
2248
|
+
if (!previousItem && !matchingOtherItems.length && settingsValuesEqual(currentItem, contributedItem)) {
|
|
2249
|
+
next.splice(index, 1);
|
|
2250
|
+
continue;
|
|
2251
|
+
}
|
|
2252
|
+
const updated = cloneSettingsValue(currentItem);
|
|
2253
|
+
for (const [field, contributedValue] of Object.entries(contributedItem)) {
|
|
2254
|
+
if (field === mergeKey || !isPlainObject(contributedValue) || !isPlainObject(updated[field])) {
|
|
2255
|
+
continue;
|
|
2256
|
+
}
|
|
2257
|
+
const previousObject = isPlainObject(previousItem) && isPlainObject(previousItem[field]) ? previousItem[field] : void 0;
|
|
2258
|
+
const otherObjects = matchingOtherItems.map((item) => item[field]).filter(isPlainObject);
|
|
2259
|
+
const nested = removeNestedSettingsContribution(
|
|
2260
|
+
updated[field],
|
|
2261
|
+
contributedValue,
|
|
2262
|
+
previousObject,
|
|
2263
|
+
otherObjects
|
|
2264
|
+
);
|
|
2265
|
+
updated[field] = nested;
|
|
2266
|
+
}
|
|
2267
|
+
next[index] = updated;
|
|
2268
|
+
}
|
|
2269
|
+
return next;
|
|
2270
|
+
}
|
|
2271
|
+
return settingPath.previousValueExists ? cloneSettingsValue(settingPath.previousValue) : void 0;
|
|
2272
|
+
}
|
|
2273
|
+
async function restoreObsoleteSettings(targetDir, previousMeta, nextSettings, existingMetas) {
|
|
1783
2274
|
if (!previousMeta) {
|
|
1784
2275
|
return [];
|
|
1785
2276
|
}
|
|
@@ -1799,12 +2290,30 @@ async function restoreObsoleteSettings(targetDir, previousMeta, nextSettings) {
|
|
|
1799
2290
|
};
|
|
1800
2291
|
for (const member of previousMeta.members) {
|
|
1801
2292
|
for (const settingPath of member.settings?.paths ?? []) {
|
|
1802
|
-
if (nextSettingKeys.has(`${settingPath.targetPath}#${settingPath.path}`)) {
|
|
2293
|
+
if (!settingPath.mergeStrategy && nextSettingKeys.has(`${settingPath.targetPath}#${settingPath.path}`)) {
|
|
2294
|
+
continue;
|
|
2295
|
+
}
|
|
2296
|
+
if (!settingPath.mergeStrategy && isComposableSettingsPath(settingPath.path)) {
|
|
1803
2297
|
continue;
|
|
1804
2298
|
}
|
|
1805
2299
|
const document = await getDocument(settingPath.targetPath);
|
|
1806
2300
|
const segments = settingPath.path.split(".");
|
|
1807
|
-
if (settingPath.
|
|
2301
|
+
if (settingPath.mergeStrategy) {
|
|
2302
|
+
const current = document.hasIn(segments) ? getPlainYamlValue(document, segments) : void 0;
|
|
2303
|
+
const otherManagedValues = listOtherManagedSettingValues(
|
|
2304
|
+
existingMetas,
|
|
2305
|
+
previousMeta.name,
|
|
2306
|
+
settingPath.targetPath,
|
|
2307
|
+
settingPath.path,
|
|
2308
|
+
settingPath.mergeStrategy
|
|
2309
|
+
);
|
|
2310
|
+
const restored = removeManagedSettingContribution(current, settingPath, otherManagedValues);
|
|
2311
|
+
if (restored === void 0) {
|
|
2312
|
+
document.deleteIn(segments);
|
|
2313
|
+
} else {
|
|
2314
|
+
document.setIn(segments, restored);
|
|
2315
|
+
}
|
|
2316
|
+
} else if (settingPath.previousValueExists) {
|
|
1808
2317
|
document.setIn(segments, settingPath.previousValue);
|
|
1809
2318
|
} else {
|
|
1810
2319
|
document.deleteIn(segments);
|
|
@@ -1896,6 +2405,16 @@ async function validateInstallConflicts(targetDir, plan, existingMetas) {
|
|
|
1896
2405
|
const settingsOwnership = buildSettingsOwnershipMap(existingMetas);
|
|
1897
2406
|
const conflicts = [];
|
|
1898
2407
|
const packageJson = await readPackageJson(targetDir);
|
|
2408
|
+
const settingsDocuments = /* @__PURE__ */ new Map();
|
|
2409
|
+
const getSettingsDocument = async (targetPath) => {
|
|
2410
|
+
const cached = settingsDocuments.get(targetPath);
|
|
2411
|
+
if (cached) {
|
|
2412
|
+
return cached;
|
|
2413
|
+
}
|
|
2414
|
+
const document = await readYamlDocument(ensurePathInsideTarget(targetDir, targetPath));
|
|
2415
|
+
settingsDocuments.set(targetPath, document);
|
|
2416
|
+
return document;
|
|
2417
|
+
};
|
|
1899
2418
|
for (const dependency of listNpmDependencies(resolveInstallNpm(plan.manifest))) {
|
|
1900
2419
|
const existing = findPackageDependency(packageJson, dependency.packageName);
|
|
1901
2420
|
if (existing && !isExistingNpmDependencyCompatible(existing, dependency.version)) {
|
|
@@ -1936,8 +2455,41 @@ async function validateInstallConflicts(targetDir, plan, existingMetas) {
|
|
|
1936
2455
|
}
|
|
1937
2456
|
}
|
|
1938
2457
|
for (const item of listPlannedSettingPaths(plan.settings)) {
|
|
2458
|
+
const document = await getSettingsDocument(item.targetPath);
|
|
2459
|
+
const currentValue = document.hasIn(item.segments) ? getPlainYamlValue(document, item.segments) : void 0;
|
|
2460
|
+
if (item.mergeStrategy === "shared-requirement" && !sharedRequirementValuesCompatible(item.path, currentValue, item.value)) {
|
|
2461
|
+
conflicts.push({
|
|
2462
|
+
kind: "setting_value_conflict",
|
|
2463
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2464
|
+
sourcePath: item.sourceRelativePath,
|
|
2465
|
+
memberName: item.memberName,
|
|
2466
|
+
memberType: "settings",
|
|
2467
|
+
settingPath: item.path,
|
|
2468
|
+
currentValue,
|
|
2469
|
+
nextValue: item.value,
|
|
2470
|
+
message: `${item.targetPath}#${item.path} has an incompatible shared requirement value`
|
|
2471
|
+
});
|
|
2472
|
+
continue;
|
|
2473
|
+
}
|
|
2474
|
+
if (item.mergeStrategy === "merge-by-key") {
|
|
2475
|
+
const conflict = findMergeByKeyConflict(currentValue, item.value, item.mergeKey ?? "code");
|
|
2476
|
+
if (conflict) {
|
|
2477
|
+
conflicts.push({
|
|
2478
|
+
kind: "setting_value_conflict",
|
|
2479
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2480
|
+
sourcePath: item.sourceRelativePath,
|
|
2481
|
+
memberName: item.memberName,
|
|
2482
|
+
memberType: "settings",
|
|
2483
|
+
settingPath: item.path,
|
|
2484
|
+
currentValue: conflict.currentValue,
|
|
2485
|
+
nextValue: conflict.nextValue,
|
|
2486
|
+
message: `${item.targetPath}#${item.path} contains an incompatible keyed setting value`
|
|
2487
|
+
});
|
|
2488
|
+
continue;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
1939
2491
|
const owner = settingsOwnership.get(`${item.targetPath}#${item.path}`);
|
|
1940
|
-
if (owner && owner !== plan.manifest.name) {
|
|
2492
|
+
if (!item.mergeStrategy && owner && owner !== plan.manifest.name) {
|
|
1941
2493
|
conflicts.push({
|
|
1942
2494
|
kind: "owned_by_other_addon",
|
|
1943
2495
|
path: `${item.targetPath}#${item.path}`,
|
|
@@ -2071,12 +2623,13 @@ async function validateUpgradeConflicts(targetDir, plan, existingMetas, previous
|
|
|
2071
2623
|
const segments = settingPath.path.split(".");
|
|
2072
2624
|
const currentValue = document.hasIn(segments) ? getPlainYamlValue(document, segments) : void 0;
|
|
2073
2625
|
const actualSha256 = sha256Value(currentValue);
|
|
2074
|
-
if (actualSha256 === settingPath.sha256) {
|
|
2075
|
-
continue;
|
|
2076
|
-
}
|
|
2077
2626
|
const settingKey = `${settingPath.targetPath}#${settingPath.path}`;
|
|
2078
2627
|
const isStillManaged = nextSettingKeys.has(settingKey);
|
|
2079
2628
|
const nextSetting = plannedSettingsByKey.get(settingKey);
|
|
2629
|
+
const contributionPresent = settingPath.mergeStrategy ? managedSettingContributionPresent(currentValue, settingPath) : nextSetting?.mergeStrategy ? plannedSettingContributionPresent(currentValue, nextSetting, settingPath.previousValue) : actualSha256 === settingPath.sha256;
|
|
2630
|
+
if (contributionPresent) {
|
|
2631
|
+
continue;
|
|
2632
|
+
}
|
|
2080
2633
|
conflicts.push({
|
|
2081
2634
|
kind: isStillManaged ? "managed_file_modified" : "obsolete_file_modified",
|
|
2082
2635
|
path: settingKey,
|
|
@@ -2094,8 +2647,24 @@ async function validateUpgradeConflicts(targetDir, plan, existingMetas, previous
|
|
|
2094
2647
|
}
|
|
2095
2648
|
}
|
|
2096
2649
|
for (const item of plannedSettings) {
|
|
2650
|
+
const document = await getSettingsDocument(item.targetPath);
|
|
2651
|
+
const currentValue = document.hasIn(item.segments) ? getPlainYamlValue(document, item.segments) : void 0;
|
|
2652
|
+
if (item.mergeStrategy === "shared-requirement" && !sharedRequirementValuesCompatible(item.path, currentValue, item.value)) {
|
|
2653
|
+
conflicts.push({
|
|
2654
|
+
kind: "setting_value_conflict",
|
|
2655
|
+
path: `${item.targetPath}#${item.path}`,
|
|
2656
|
+
sourcePath: item.sourceRelativePath,
|
|
2657
|
+
memberName: item.memberName,
|
|
2658
|
+
memberType: "settings",
|
|
2659
|
+
settingPath: item.path,
|
|
2660
|
+
currentValue,
|
|
2661
|
+
nextValue: item.value,
|
|
2662
|
+
message: `${item.targetPath}#${item.path} has an incompatible shared requirement value`
|
|
2663
|
+
});
|
|
2664
|
+
continue;
|
|
2665
|
+
}
|
|
2097
2666
|
const owner = settingsOwnership.get(`${item.targetPath}#${item.path}`);
|
|
2098
|
-
if (owner) {
|
|
2667
|
+
if (!item.mergeStrategy && owner) {
|
|
2099
2668
|
conflicts.push({
|
|
2100
2669
|
kind: "owned_by_other_addon",
|
|
2101
2670
|
path: `${item.targetPath}#${item.path}`,
|
|
@@ -2162,11 +2731,17 @@ async function materializeAddon(options) {
|
|
|
2162
2731
|
} else if (previousMeta) {
|
|
2163
2732
|
await validateUpgradeConflicts(targetDir, plan, existingMetas, previousMeta);
|
|
2164
2733
|
}
|
|
2734
|
+
const workflowDatasetBinding = await prepareWorkflowDatasetBinding(options, plan);
|
|
2165
2735
|
const removedFiles = previousMeta ? await removeObsoleteFiles(targetDir, previousMeta, new Set(plan.files.map((file) => file.targetPath))) : [];
|
|
2166
|
-
const restoredSettingsFiles = await restoreObsoleteSettings(
|
|
2736
|
+
const restoredSettingsFiles = await restoreObsoleteSettings(
|
|
2737
|
+
targetDir,
|
|
2738
|
+
previousMeta,
|
|
2739
|
+
plan.settings,
|
|
2740
|
+
existingMetas
|
|
2741
|
+
);
|
|
2167
2742
|
const npm = resolveInstallNpm(plan.manifest);
|
|
2168
2743
|
const packageJsonFiles = await applyNpmDependencies(targetDir, npm);
|
|
2169
|
-
await writePlannedFiles(targetDir, plan.files);
|
|
2744
|
+
await writePlannedFiles(targetDir, plan.files, workflowDatasetBinding?.contentByTargetPath);
|
|
2170
2745
|
const settingsResult = await applyPlannedSettings(targetDir, plan.settings);
|
|
2171
2746
|
const promptContent = options.promptContent?.trim() || void 0;
|
|
2172
2747
|
const promptFiles = await writeAddonPromptFile(targetDir, plan.manifest.name, promptContent);
|
|
@@ -2208,7 +2783,8 @@ async function materializeAddon(options) {
|
|
|
2208
2783
|
requirements,
|
|
2209
2784
|
missingRequirements: buildMissingRequirements(requirements),
|
|
2210
2785
|
npm,
|
|
2211
|
-
llmGuidance
|
|
2786
|
+
llmGuidance,
|
|
2787
|
+
workflowDatasetBinding: workflowDatasetBinding ? { boundFiles: workflowDatasetBinding.boundFiles } : void 0
|
|
2212
2788
|
};
|
|
2213
2789
|
}
|
|
2214
2790
|
async function installAddonFromExtractedDirectory(options) {
|
|
@@ -3909,7 +4485,8 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3909
4485
|
version: result.meta.version,
|
|
3910
4486
|
applicationType: result.meta.applicationType
|
|
3911
4487
|
},
|
|
3912
|
-
llmGuidance: result.llmGuidance
|
|
4488
|
+
llmGuidance: result.llmGuidance,
|
|
4489
|
+
...result.workflowDatasetBinding ? { workflowDatasetBinding: result.workflowDatasetBinding } : {}
|
|
3913
4490
|
};
|
|
3914
4491
|
if (options.json) {
|
|
3915
4492
|
renderOutput(output, options);
|
|
@@ -3923,6 +4500,9 @@ function renderAddonInstallResult(result, operation, options) {
|
|
|
3923
4500
|
if (result.removedFiles.length) {
|
|
3924
4501
|
lines.push(`Removed files: ${result.removedFiles.length}`);
|
|
3925
4502
|
}
|
|
4503
|
+
if (result.workflowDatasetBinding?.boundFiles.length) {
|
|
4504
|
+
lines.push(`Bound encrypted Workflow dataset IDs: ${result.workflowDatasetBinding.boundFiles.join(", ")}`);
|
|
4505
|
+
}
|
|
3926
4506
|
if (result.llmGuidance.webRoutes?.length) {
|
|
3927
4507
|
lines.push("Next: wire web routes from llmGuidance.webRoutes.");
|
|
3928
4508
|
}
|