auriga-cli 1.20.2 → 1.20.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 +19 -11
- package/package.json +1 -1
package/dist/catalog.json
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -51,14 +51,13 @@ export function validatePluginsConfig(raw) {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function getInstalledPlugins() {
|
|
54
|
+
function getInstalledPlugins(cwd = process.cwd()) {
|
|
55
55
|
try {
|
|
56
56
|
const output = exec("claude plugins list --json");
|
|
57
57
|
const plugins = JSON.parse(output);
|
|
58
|
-
const cwd = process.cwd();
|
|
59
58
|
const installed = new Map();
|
|
60
59
|
for (const p of plugins) {
|
|
61
|
-
// project scope
|
|
60
|
+
// project scope 只匹配目标目录
|
|
62
61
|
if (p.scope === "project" && p.projectPath !== cwd)
|
|
63
62
|
continue;
|
|
64
63
|
const scopes = installed.get(p.id) || [];
|
|
@@ -692,7 +691,8 @@ export async function installPlugins(packageRoot, opts) {
|
|
|
692
691
|
}))
|
|
693
692
|
: opts.scope ?? "project";
|
|
694
693
|
if (config) {
|
|
695
|
-
const
|
|
694
|
+
const targetCwd = installTargetCwd(opts);
|
|
695
|
+
const installed = getInstalledPlugins(targetCwd);
|
|
696
696
|
let selected;
|
|
697
697
|
try {
|
|
698
698
|
selected = opts.interactive
|
|
@@ -779,12 +779,20 @@ export async function installPlugins(packageRoot, opts) {
|
|
|
779
779
|
failures.push(`marketplace ${name}`);
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
// Install plugins
|
|
782
|
+
// Install or upgrade plugins. `claude plugins install` is a no-op
|
|
783
|
+
// when the plugin is already installed at the target scope, so a
|
|
784
|
+
// reinstall would silently skip the upgrade — even after the
|
|
785
|
+
// marketplace was refreshed above. Branch to `claude plugins update`
|
|
786
|
+
// for already-installed-at-target-scope plugins so the cached
|
|
787
|
+
// version actually advances. Mirrors the marketplace add/update
|
|
788
|
+
// branching right above.
|
|
783
789
|
for (const plugin of selected) {
|
|
784
|
-
|
|
790
|
+
const isUpdate = installed.get(plugin.package)?.includes(scope) ?? false;
|
|
791
|
+
const action = isUpdate ? "update" : "install";
|
|
792
|
+
console.log(`\n${isUpdate ? "Updating" : "Installing"} ${plugin.name}...`);
|
|
785
793
|
try {
|
|
786
|
-
const cmd = `claude plugins
|
|
787
|
-
const cmdOpts = { cwd:
|
|
794
|
+
const cmd = `claude plugins ${action} ${plugin.package} --scope ${scope}`;
|
|
795
|
+
const cmdOpts = { cwd: targetCwd };
|
|
788
796
|
if (opts.onLog) {
|
|
789
797
|
opts.onLog(`▸ ${cmd}`, "stdout");
|
|
790
798
|
await execAsync(cmd, { ...cmdOpts, onLine: opts.onLog });
|
|
@@ -792,11 +800,11 @@ export async function installPlugins(packageRoot, opts) {
|
|
|
792
800
|
else {
|
|
793
801
|
exec(cmd, { ...cmdOpts, inherit: true });
|
|
794
802
|
}
|
|
795
|
-
log.ok(`${plugin.name} installed`);
|
|
803
|
+
log.ok(`${plugin.name} ${isUpdate ? "updated" : "installed"}`);
|
|
796
804
|
runPostInstallMigration(plugin.name, { ...opts, scope }, ["claude"]);
|
|
797
805
|
}
|
|
798
|
-
catch {
|
|
799
|
-
log.error(`Failed to
|
|
806
|
+
catch (e) {
|
|
807
|
+
log.error(`Failed to ${action}: ${plugin.name}\n${commandErrorText(e)}`);
|
|
800
808
|
failures.push(plugin.name);
|
|
801
809
|
}
|
|
802
810
|
}
|
package/package.json
CHANGED