@codecademy/gamut

68.2.268.2.3-alpha.b8b211.0
bin/commands/plugin/update.mjs
+bin/commands/plugin/update.mjsNew file
+49
Index: package/bin/commands/plugin/update.mjs
===================================================================
--- package/bin/commands/plugin/update.mjs
+++ package/bin/commands/plugin/update.mjs
@@ -0,0 +1,49 @@
+import { getFlag } from '../../lib/resolve-plugin-dir.mjs';
+import install, { TARGETS } from './install.mjs';
+
+export function help() {
+  console.log(`
+Usage:
+  gamut plugin update [target] [options]
+
+Update the Gamut plugin in an AI or design tool.
+Equivalent to re-running install — replaces the existing installation in place.
+
+Arguments:
+  target               Tool to update (default: cursor)
+                       cursor | claude | figma
+
+Options:
+  --scope <scope>      Content to update (default: all)
+                       all | skills | rules | commands | agents
+  --plugin-dir <path>  Override the bundled agent-tools directory
+  -h, --help           Show this help message
+
+Examples:
+  gamut plugin update
+  gamut plugin update claude
+  gamut plugin update cursor --scope skills
+`);
+}
+
+/**
+ * gamut plugin update [cursor|claude|figma] [--scope all|skills|rules|commands|agents]
+ *                                           [--plugin-dir <path>]
+ *
+ * Re-runs install with the same arguments. For Cursor this does an in-place
+ * copy replacing any existing installation. For Claude Code it updates the
+ * marketplace entry and re-installs.
+ *
+ * @param {string[]} args
+ */
+export default async function update(args) {
+  const target = args.find((a) => !a.startsWith('-')) ?? 'cursor';
+  const scope = getFlag(args, '--scope', 'all') ?? 'all';
+
+  if (!TARGETS.includes(target)) {
+    throw new Error(`Unknown target: "${target}". Choose from: ${TARGETS.join(', ')}`);
+  }
+
+  console.log(`Updating Gamut plugin for ${target}${scope !== 'all' ? ` (scope: ${scope})` : ''}…`);
+  await install(args);
+}