arbella 0.1.0 → 0.1.1
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/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -908,7 +908,7 @@ function splitPluginId(id) {
|
|
|
908
908
|
if (at <= 0) return { name: id };
|
|
909
909
|
return { name: id.slice(0, at), marketplace: id.slice(at + 1) };
|
|
910
910
|
}
|
|
911
|
-
function parseInstalledPlugins(json) {
|
|
911
|
+
function parseInstalledPlugins(json, foldPath = (p) => p) {
|
|
912
912
|
if (!isRecord(json)) return [];
|
|
913
913
|
const plugins = json.plugins;
|
|
914
914
|
if (!isRecord(plugins)) return [];
|
|
@@ -921,7 +921,7 @@ function parseInstalledPlugins(json) {
|
|
|
921
921
|
if (!isRecord(rec)) continue;
|
|
922
922
|
const scope = rec.scope === "project" ? "project" : "user";
|
|
923
923
|
const version = typeof rec.version === "string" ? rec.version : void 0;
|
|
924
|
-
const projectPath = typeof rec.projectPath === "string" ? rec.projectPath : void 0;
|
|
924
|
+
const projectPath = typeof rec.projectPath === "string" ? foldPath(rec.projectPath) : void 0;
|
|
925
925
|
const entry = {
|
|
926
926
|
id,
|
|
927
927
|
name,
|
|
@@ -1119,7 +1119,10 @@ async function capture(ctx, opts) {
|
|
|
1119
1119
|
const installedJson = await readJson(ctx, p.installedPlugins, warnings, "installed_plugins.json");
|
|
1120
1120
|
const marketplacesJson = await readJson(ctx, p.knownMarketplaces, warnings, "known_marketplaces.json");
|
|
1121
1121
|
const settingsJson = await readJson(ctx, p.settings, warnings, "settings.json");
|
|
1122
|
-
const plugins = parseInstalledPlugins(
|
|
1122
|
+
const plugins = parseInstalledPlugins(
|
|
1123
|
+
installedJson,
|
|
1124
|
+
(p2) => ctx.templater.toTemplate(p2, ctx.vars)
|
|
1125
|
+
);
|
|
1123
1126
|
const marketplaces = parseKnownMarketplaces(marketplacesJson);
|
|
1124
1127
|
const enabledPlugins = extractEnabledPlugins(settingsJson);
|
|
1125
1128
|
for (const entry of plugins) {
|
|
@@ -2060,8 +2063,11 @@ async function planActions2(ctx, data) {
|
|
|
2060
2063
|
description: `Register marketplace ${m.id} (${m.source})`
|
|
2061
2064
|
});
|
|
2062
2065
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2066
|
+
const { installable } = partitionPluginsForRestore(
|
|
2067
|
+
data.manifest.marketplaces,
|
|
2068
|
+
data.manifest.plugins.filter((p) => p.scope === "user")
|
|
2069
|
+
);
|
|
2070
|
+
for (const plugin of installable) {
|
|
2065
2071
|
actions.push({
|
|
2066
2072
|
type: "install-plugin",
|
|
2067
2073
|
tool: "codex",
|
|
@@ -2117,6 +2123,19 @@ async function writeCapturedFile(ctx, file, overwriteAllowed) {
|
|
|
2117
2123
|
const content = isConfigToml(rel) ? rehydrateConfigToml(file.content, ctx.templater, ctx.vars) : ctx.templater.fromTemplate(file.content, ctx.vars);
|
|
2118
2124
|
await ctx.fs.write(targetPath, content, file.mode);
|
|
2119
2125
|
}
|
|
2126
|
+
function partitionPluginsForRestore(marketplaces, userPlugins) {
|
|
2127
|
+
const known = new Set(marketplaces.map((m) => m.id));
|
|
2128
|
+
const installable = [];
|
|
2129
|
+
const deferred = [];
|
|
2130
|
+
for (const p of userPlugins) {
|
|
2131
|
+
if (p.marketplace !== void 0 && !known.has(p.marketplace)) {
|
|
2132
|
+
deferred.push(p);
|
|
2133
|
+
} else {
|
|
2134
|
+
installable.push(p);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
return { installable, deferred };
|
|
2138
|
+
}
|
|
2120
2139
|
async function reinstallPluginsAndMarketplaces(ctx, marketplaces, plugins) {
|
|
2121
2140
|
const userPlugins = plugins.filter((p) => p.scope === "user");
|
|
2122
2141
|
if (marketplaces.length === 0 && userPlugins.length === 0) return;
|
|
@@ -2137,7 +2156,13 @@ async function reinstallPluginsAndMarketplaces(ctx, marketplaces, plugins) {
|
|
|
2137
2156
|
ctx.log.warn(`codex: 'codex ${args.join(" ")}' failed (${msg}); config.toml retains it.`);
|
|
2138
2157
|
}
|
|
2139
2158
|
}
|
|
2140
|
-
|
|
2159
|
+
const { installable, deferred } = partitionPluginsForRestore(marketplaces, userPlugins);
|
|
2160
|
+
for (const plugin of deferred) {
|
|
2161
|
+
ctx.log.step(
|
|
2162
|
+
`codex: ${plugin.id} uses a built-in marketplace (${plugin.marketplace}); left to config.toml for Codex to re-sync.`
|
|
2163
|
+
);
|
|
2164
|
+
}
|
|
2165
|
+
for (const plugin of installable) {
|
|
2141
2166
|
const args = pluginInstallArgs2(plugin);
|
|
2142
2167
|
try {
|
|
2143
2168
|
await execa3("codex", args, { stdout: "ignore", stderr: "ignore", stdin: "ignore" });
|
|
@@ -2169,7 +2194,7 @@ function marketplaceAddArgs2(m) {
|
|
|
2169
2194
|
return ["plugin", "marketplace", "add", m.source];
|
|
2170
2195
|
}
|
|
2171
2196
|
function pluginInstallArgs2(p) {
|
|
2172
|
-
return ["plugin", "
|
|
2197
|
+
return ["plugin", "add", p.id];
|
|
2173
2198
|
}
|
|
2174
2199
|
var PREFIX_WITH_SLASH;
|
|
2175
2200
|
var init_restore2 = __esm({
|