@gadmin2n/cli 0.0.104 → 0.0.105
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/actions/update.action.js +12 -0
- package/package.json +1 -1
package/actions/update.action.js
CHANGED
|
@@ -638,6 +638,18 @@ class UpdateAction extends abstract_action_1.AbstractAction {
|
|
|
638
638
|
console.error(chalk.red(`Unknown subcommand "${subcommand}". Expected: (none) | diff`));
|
|
639
639
|
process.exit(1);
|
|
640
640
|
}
|
|
641
|
+
// Guard: refuse to run anywhere except a gadmin2 instance project root.
|
|
642
|
+
// The canonical marker is server/gadmin-cli.json (created by `gadmin2 n`).
|
|
643
|
+
// We check this up-front so commands like `gadmin2 update --no-template`
|
|
644
|
+
// can't silently sync .claude into an unrelated directory.
|
|
645
|
+
const instanceMarker = path.join(process.cwd(), 'server', 'gadmin-cli.json');
|
|
646
|
+
if (!fs.existsSync(instanceMarker)) {
|
|
647
|
+
console.error(chalk.red('\nNot at a gadmin2 instance project root.\n' +
|
|
648
|
+
` Expected to find: server/gadmin-cli.json\n` +
|
|
649
|
+
` Current directory: ${process.cwd()}\n\n` +
|
|
650
|
+
'Run this command from the project root created by `gadmin2 n <name>`.\n'));
|
|
651
|
+
process.exit(1);
|
|
652
|
+
}
|
|
641
653
|
// Pre-flight version check (B): silent network call to npm registry,
|
|
642
654
|
// hard 1.5s timeout, never blocks. Prints a yellow banner if outdated.
|
|
643
655
|
const versionCheckEnabled = ((_b = options.find((o) => o.name === 'version-check')) === null || _b === void 0 ? void 0 : _b.value) !==
|