vmlive 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +56 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vmlive",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Local development VM for custom Serverless PaaS",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -680,6 +680,43 @@ const runLogin = async () => {
680
680
  });
681
681
  };
682
682
 
683
+ const runUpdate = async () => {
684
+ console.log('\x1b[36mUpdating vmlive to the latest version...\x1b[0m');
685
+ const { spawn } = await import('child_process');
686
+
687
+ const updateProcess = spawn('npm', ['install', 'vmlive@latest'], {
688
+ stdio: 'inherit'
689
+ });
690
+
691
+ updateProcess.on('exit', (code) => {
692
+ if (code === 0) {
693
+ console.log('\n\x1b[32m✔ vmlive updated successfully!\x1b[0m');
694
+ } else {
695
+ console.error(`\n\x1b[31m❌ Update failed with exit code ${code}\x1b[0m`);
696
+ }
697
+ process.exit(code || 0);
698
+ });
699
+ });
700
+ };
701
+
702
+ const runLlm = async () => {
703
+ const GATEKEEPER_URL = process.env.GATEKEEPER_URL || 'https://api.vm.live';
704
+ console.log('\x1b[36mDownloading AI Context Guide...\x1b[0m');
705
+ try {
706
+ const res = await fetch(`${GATEKEEPER_URL}/vmlive-ai-rules.md`);
707
+ if (!res.ok) {
708
+ console.error('\x1b[31m❌ Failed to download AI rules:\x1b[0m', res.status);
709
+ process.exit(1);
710
+ }
711
+ const markdown = await res.text();
712
+ fs.writeFileSync(path.join(process.cwd(), 'vmlive-ai-rules.md'), markdown);
713
+ console.log('\x1b[32m✔ Successfully wrote vmlive-ai-rules.md to current directory.\x1b[0m');
714
+ console.log('\x1b[90m(Add this to your prompt context so your AI perfectly architect endpoints for you!)\x1b[0m');
715
+ } catch (err) {
716
+ console.error('\x1b[31m❌ Connection Failed:\x1b[0m', err.message);
717
+ process.exit(1);
718
+ }
719
+ };
683
720
  const main = async () => {
684
721
  const command = process.argv[2];
685
722
  if (command === 'init') {
@@ -692,12 +729,29 @@ const main = async () => {
692
729
  await runLogin();
693
730
  } else if (command === 'deploy') {
694
731
  await runDeploy();
732
+ } else if (command === 'update') {
733
+ await runUpdate();
734
+ } else if (command === 'llm') {
735
+ await runLlm();
736
+ } else if (command === 'help' || !command) {
737
+ console.log('\n\x1b[1m\x1b[36mvm.live\x1b[0m - Serverless Edge Compute Engine');
738
+ console.log('Usage: vmlive <command>\n');
739
+ console.log('Commands:');
740
+ console.log(' \x1b[32minit\x1b[0m Scaffold a new vm.live sandbox in the current directory');
741
+ console.log(' \x1b[32madd\x1b[0m Add a new microservice endpoint to your existing workspace');
742
+ console.log(' \x1b[32mdev\x1b[0m Start the local emulator and dashboard over localhost');
743
+ console.log(' \x1b[32mlogin\x1b[0m Authenticate your local environment securely via Stripe/OAuth');
744
+ console.log(' \x1b[32mdeploy\x1b[0m Upload your footprint to the vm.live edge platform');
745
+ console.log(' \x1b[32mllm\x1b[0m Download the official AI Context Rules for agentic workflows');
746
+ console.log(' \x1b[32mupdate\x1b[0m Upgrade this CLI engine to the latest published version');
747
+ console.log(' \x1b[32mwhich\x1b[0m Display the currently active CLI version');
748
+ console.log('');
695
749
  } else if (command === 'which' || command === '-v' || command === '--version' || command === 'v') {
696
750
  const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf-8'));
697
751
  console.log(`vmlive CLI v${pkg.version}`);
698
752
  } else {
699
- console.error(`\x1b[31m❌ Unknown command: ${command || 'missing'}\x1b[0m`);
700
- console.log('Usage: vmlive init | vmlive add | vmlive dev | vmlive login | vmlive deploy | vmlive which');
753
+ console.error(`\x1b[31m❌ Unknown command: ${command}\x1b[0m`);
754
+ console.log('Run \x1b[36mvmlive help\x1b[0m to see available commands.');
701
755
  process.exit(1);
702
756
  }
703
757
  };