auriga-cli 1.10.1 → 1.10.3
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/catalog.json +1 -1
- package/dist/plugins.js +42 -7
- package/package.json +1 -1
package/dist/catalog.json
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { checkbox, select } from "@inquirer/prompts";
|
|
5
5
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
6
6
|
import { codexManifestPath, validateCodexInstallConfig, validateCodexMarketplace, } from "./codex-plugin-config.js";
|
|
7
|
-
import { atomicWriteFile, exec, fetchExtraContent, log,
|
|
7
|
+
import { atomicWriteFile, exec, fetchExtraContent, log, withEsc } from "./utils.js";
|
|
8
8
|
// Plugin names, marketplace names/sources, and plugin-package names all
|
|
9
9
|
// end up in `claude plugins ...` shell commands via string interpolation.
|
|
10
10
|
// .claude/plugins.json is fetched from raw GitHub at runtime, so every
|
|
@@ -134,8 +134,30 @@ function codexMarketplaceAddCommand(packageRoot) {
|
|
|
134
134
|
if (process.env.DEV === "1") {
|
|
135
135
|
return `codex plugin marketplace add ${shellQuote(packageRoot)}`;
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
return "codex plugin marketplace add https://github.com/Ben2pc/auriga-cli.git";
|
|
138
|
+
}
|
|
139
|
+
function codexMarketplaceUpgradeCommand(marketplaceName) {
|
|
140
|
+
return `codex plugin marketplace upgrade ${shellQuote(marketplaceName)}`;
|
|
141
|
+
}
|
|
142
|
+
function commandErrorText(error) {
|
|
143
|
+
if (!(error instanceof Error))
|
|
144
|
+
return String(error);
|
|
145
|
+
const parts = [error.message];
|
|
146
|
+
const withOutput = error;
|
|
147
|
+
if (withOutput.stdout)
|
|
148
|
+
parts.push(String(withOutput.stdout));
|
|
149
|
+
if (withOutput.stderr)
|
|
150
|
+
parts.push(String(withOutput.stderr));
|
|
151
|
+
return parts.join("\n");
|
|
152
|
+
}
|
|
153
|
+
function escapeRegex(value) {
|
|
154
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
155
|
+
}
|
|
156
|
+
function isCodexMarketplaceAlreadyAdded(error, marketplaceName) {
|
|
157
|
+
const text = commandErrorText(error);
|
|
158
|
+
const marketplacePattern = new RegExp(`marketplace ['"]?${escapeRegex(marketplaceName)}['"]? is already added`, "i");
|
|
159
|
+
return marketplacePattern.test(text)
|
|
160
|
+
|| /already added from a different source/i.test(text);
|
|
139
161
|
}
|
|
140
162
|
function pluginHasHooks(packageRoot, plugin) {
|
|
141
163
|
const relativeManifestPath = codexManifestPath(plugin);
|
|
@@ -284,13 +306,26 @@ async function installCodexPlugins(packageRoot, opts) {
|
|
|
284
306
|
return;
|
|
285
307
|
}
|
|
286
308
|
const failures = [];
|
|
309
|
+
const marketplaceExecOpts = opts.interactive ? { inherit: true } : undefined;
|
|
287
310
|
try {
|
|
288
|
-
exec(codexMarketplaceAddCommand(packageRoot),
|
|
311
|
+
exec(codexMarketplaceAddCommand(packageRoot), marketplaceExecOpts);
|
|
289
312
|
log.ok(`Codex marketplace ${marketplace.name} added`);
|
|
290
313
|
}
|
|
291
|
-
catch {
|
|
292
|
-
|
|
293
|
-
|
|
314
|
+
catch (e) {
|
|
315
|
+
if (opts.interactive || isCodexMarketplaceAlreadyAdded(e, marketplace.name)) {
|
|
316
|
+
try {
|
|
317
|
+
exec(codexMarketplaceUpgradeCommand(marketplace.name), marketplaceExecOpts);
|
|
318
|
+
log.ok(`Codex marketplace ${marketplace.name} upgraded`);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
log.error(`Failed to upgrade Codex marketplace: ${marketplace.name}`);
|
|
322
|
+
failures.push(`codex marketplace ${marketplace.name}`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
log.error(`Failed to add Codex marketplace: ${marketplace.name}`);
|
|
327
|
+
failures.push(`codex marketplace ${marketplace.name}`);
|
|
328
|
+
}
|
|
294
329
|
}
|
|
295
330
|
if (failures.length === 0) {
|
|
296
331
|
const selectedMarketplacePlugins = selected.map((p) => {
|
package/package.json
CHANGED