Skip to content

Commit c8eb295

Browse files
Copilottheoephraim
andauthored
feat: guard install-plugin command to standalone binary only
Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/9864be8b-0363-4168-a52f-28bcd6d18784 Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
1 parent 3e9c208 commit c8eb295

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/varlock/src/cli/commands/install-plugin.command.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import semver from 'semver';
44

55
import { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';
66
import { CliExitError } from '../helpers/exit-error';
7+
import { isBundledSEA } from '../helpers/install-detection';
8+
import { fmt } from '../helpers/pretty-format';
79
import { downloadPluginToCache } from '../../env-graph/lib/plugins';
810

911
export const commandSpec = define({
@@ -29,6 +31,13 @@ Examples:
2931
});
3032

3133
export const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {
34+
if (!isBundledSEA()) {
35+
throw new CliExitError('This command is only available when using the standalone varlock binary', {
36+
suggestion: 'In a JS project, install plugins as regular dependencies using your package manager.\n'
37+
+ `For example: ${fmt.command('add my-plugin', { jsPackageManager: true })}`,
38+
});
39+
}
40+
3241
const pluginDescriptor = ctx.values.plugin as string | undefined;
3342

3443
if (!pluginDescriptor) {

0 commit comments

Comments
 (0)