auriga-cli 1.30.0 → 1.30.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/catalog.json +1 -1
- package/dist/plugins.js +25 -43
- package/package.json +1 -1
package/dist/catalog.json
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -3,7 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { checkbox, select } from "@inquirer/prompts";
|
|
5
5
|
import { parse as parseToml } from "smol-toml";
|
|
6
|
-
import {
|
|
6
|
+
import { validateCodexMarketplace, } from "./codex-plugin-config.js";
|
|
7
7
|
import { validateMarketplaceField } from "./marketplace.js";
|
|
8
8
|
import { atomicWriteFile, exec, execAsync, log, withEsc } from "./utils.js";
|
|
9
9
|
// Plugin names and plugin-package names end up in `claude plugins ...`
|
|
@@ -467,12 +467,15 @@ function codexSupportsPluginAdd() {
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
// `--enable plugins` turns on the global Codex plugins feature; `--enable
|
|
470
|
-
// plugin_hooks`
|
|
471
|
-
// feature
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
//
|
|
475
|
-
//
|
|
470
|
+
// plugin_hooks` turns on the global plugin-hooks feature. Both are plain
|
|
471
|
+
// Codex feature toggles (`-c features.<name>=true`), not per-plugin state —
|
|
472
|
+
// `plugin_hooks` is appended for first-party plugins, which ship hooks, and
|
|
473
|
+
// is harmless for any that don't (the feature simply has no hooks to run).
|
|
474
|
+
// We do not inspect plugin payload to decide this: Codex owns plugin
|
|
475
|
+
// content via `codex plugin add`, and the published CLI never fetches the
|
|
476
|
+
// payload anyway. The plugin key (`<name>@<marketplace>`) is validated
|
|
477
|
+
// upstream (PLUGIN_NAME_RE / MARKETPLACE_NAME_RE), so no shell
|
|
478
|
+
// metacharacter can reach this interpolated command.
|
|
476
479
|
function codexPluginAddCommand(pluginKey, hasHooks) {
|
|
477
480
|
const enable = hasHooks
|
|
478
481
|
? "--enable plugins --enable plugin_hooks"
|
|
@@ -524,16 +527,6 @@ function readCodexMarketplaceSource(marketplaceName) {
|
|
|
524
527
|
function isCodexMarketplaceDifferentSource(error) {
|
|
525
528
|
return /already added from a different source/i.test(commandErrorText(error));
|
|
526
529
|
}
|
|
527
|
-
function pluginHasHooks(packageRoot, plugin) {
|
|
528
|
-
const relativeManifestPath = codexManifestPath(plugin);
|
|
529
|
-
if (!relativeManifestPath)
|
|
530
|
-
return false;
|
|
531
|
-
const manifestPath = path.join(packageRoot, relativeManifestPath);
|
|
532
|
-
if (!fs.existsSync(manifestPath))
|
|
533
|
-
return false;
|
|
534
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
535
|
-
return typeof manifest.hooks === "string" || Array.isArray(manifest.hooks);
|
|
536
|
-
}
|
|
537
530
|
function resolveSelectedCodexMarketplacePlugins(localMarketplace, localSelected) {
|
|
538
531
|
const localMpByName = new Map(localMarketplace.plugins.map((p) => [p.name, p]));
|
|
539
532
|
return localSelected.map((p) => {
|
|
@@ -544,17 +537,6 @@ function resolveSelectedCodexMarketplacePlugins(localMarketplace, localSelected)
|
|
|
544
537
|
return plugin;
|
|
545
538
|
});
|
|
546
539
|
}
|
|
547
|
-
function ensureCodexPluginManifests(packageRoot, plugins) {
|
|
548
|
-
for (const plugin of plugins) {
|
|
549
|
-
const manifestPath = codexManifestPath(plugin);
|
|
550
|
-
if (!manifestPath) {
|
|
551
|
-
throw new Error(`Codex marketplace.json: plugin ${plugin.name} must use a local source.path`);
|
|
552
|
-
}
|
|
553
|
-
if (fs.existsSync(path.join(packageRoot, manifestPath)))
|
|
554
|
-
continue;
|
|
555
|
-
throw new Error(`Codex plugin ${plugin.name} manifest missing at ${manifestPath}`);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
540
|
async function addCodexMarketplaceWithRetry(marketplaceName, addCommand, expectedSource, opts, marketplaceExecOpts, failures) {
|
|
559
541
|
const registeredSource = readCodexMarketplaceSource(marketplaceName);
|
|
560
542
|
if (registeredSource !== null) {
|
|
@@ -599,20 +581,22 @@ async function addCodexMarketplaceWithRetry(marketplaceName, addCommand, expecte
|
|
|
599
581
|
}
|
|
600
582
|
}
|
|
601
583
|
// Builds the `codex plugin add` work list: one entry per selected plugin.
|
|
602
|
-
// Local plugins
|
|
603
|
-
//
|
|
604
|
-
//
|
|
605
|
-
//
|
|
606
|
-
//
|
|
607
|
-
//
|
|
608
|
-
|
|
584
|
+
// Local (first-party) plugins always enable `plugin_hooks` — they ship
|
|
585
|
+
// hooks, and the flag is a harmless global toggle for any that don't. We
|
|
586
|
+
// deliberately do not inspect plugin payload to decide this: Codex owns
|
|
587
|
+
// plugin content via `codex plugin add`, and the published CLI never
|
|
588
|
+
// fetches the payload. External plugins emit a key straight from
|
|
589
|
+
// extra_plugin_configs.json (Codex CLI fetches the upstream manifest
|
|
590
|
+
// itself) and never set `hasHooks` — acceptable while no external plugin
|
|
591
|
+
// ships hooks; once one does, add an explicit flag to the extra config entry.
|
|
592
|
+
function composeCodexPluginAdds(localMarketplace, selectedMarketplacePlugins, externalSelected) {
|
|
609
593
|
const adds = [];
|
|
610
594
|
if (localMarketplace) {
|
|
611
595
|
for (const plugin of selectedMarketplacePlugins) {
|
|
612
596
|
adds.push({
|
|
613
597
|
key: `${plugin.name}@${localMarketplace.name}`,
|
|
614
598
|
name: plugin.name,
|
|
615
|
-
hasHooks:
|
|
599
|
+
hasHooks: true,
|
|
616
600
|
});
|
|
617
601
|
}
|
|
618
602
|
}
|
|
@@ -708,16 +692,14 @@ async function installCodexPlugins(packageRoot, opts) {
|
|
|
708
692
|
await addCodexMarketplaceWithRetry(mp.name, codexExternalMarketplaceAddCommand(mp.source), codexExternalMarketplaceSource(mp.source), opts, marketplaceExecOpts, failures);
|
|
709
693
|
}
|
|
710
694
|
if (failures.length === 0) {
|
|
711
|
-
//
|
|
712
|
-
//
|
|
713
|
-
//
|
|
714
|
-
//
|
|
715
|
-
// marketplace snapshot registered above — no manual cache copy.
|
|
695
|
+
// The plugin payload is materialized by `codex plugin add` from the
|
|
696
|
+
// marketplace snapshot registered above — no manual cache copy, and no
|
|
697
|
+
// local manifest inspection. A plugin missing from the snapshot surfaces
|
|
698
|
+
// as a `codex plugin add` failure, already caught and aggregated below.
|
|
716
699
|
const selectedMarketplacePlugins = localMarketplace
|
|
717
700
|
? resolveSelectedCodexMarketplacePlugins(localMarketplace, localSelected)
|
|
718
701
|
: [];
|
|
719
|
-
|
|
720
|
-
const pluginAdds = composeCodexPluginAdds(packageRoot, localMarketplace, selectedMarketplacePlugins, externalSelected);
|
|
702
|
+
const pluginAdds = composeCodexPluginAdds(localMarketplace, selectedMarketplacePlugins, externalSelected);
|
|
721
703
|
for (const entry of pluginAdds) {
|
|
722
704
|
try {
|
|
723
705
|
exec(codexPluginAddCommand(entry.key, entry.hasHooks), marketplaceExecOpts);
|