@justin0713/opspilot 1.0.2 → 1.0.4

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/bin/opspilot.js +15 -14
  2. package/package.json +1 -1
package/bin/opspilot.js CHANGED
@@ -20,6 +20,8 @@ const fs = require('fs');
20
20
  const path = require('path');
21
21
  const os = require('os');
22
22
 
23
+ const PKG_VERSION = require('../package.json').version;
24
+
23
25
  // ── Constants ────────────────────────────────────────────────────────────────
24
26
 
25
27
  const IMAGE = 'opspilot/local:latest';
@@ -105,14 +107,17 @@ function cmdStart(flags) {
105
107
  const port = flags.port || cfg.port || '5000';
106
108
  const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
107
109
 
108
- // Token is optional — without it OpsPilot runs in standalone mode
109
- if (token) {
110
- saveConfig({ token, cloudUrl: url || 'https://teams.codetop.net', port, dataDir: data });
111
- } else {
112
- warn('No --token provided starting in standalone mode (no license validation).');
113
- saveConfig({ port, dataDir: data });
110
+ if (!token) {
111
+ die(
112
+ 'License token is required.\n' +
113
+ ' opspilot start --token <your-license-token>\n' +
114
+ ' Get a token: log in to OpsPilot Cloud Dashboard License Tokens → Generate'
115
+ );
114
116
  }
115
117
 
118
+ // Persist for next run
119
+ saveConfig({ token, cloudUrl: url || 'https://teams.codetop.net', port, dataDir: data });
120
+
116
121
  // Stop existing container if running
117
122
  const existing = tryRun(`docker inspect -f "{{.State.Status}}" ${CONTAINER} 2>/dev/null`);
118
123
  if (existing === 'running') {
@@ -131,17 +136,13 @@ function cmdStart(flags) {
131
136
  const isAbsolute = path.isAbsolute(data);
132
137
  const volArg = `${data}:/app/data`;
133
138
 
134
- // Build docker run args — only pass cloud env vars if token is set
135
- const cloudEnv = token
136
- ? `-e OPSPILOT_CLOUD_URL=${url || 'https://teams.codetop.net'} -e OPSPILOT_CLOUD_TOKEN=${token} `
137
- : '';
138
-
139
139
  log(`Starting OpsPilot Local on port ${port} ...`);
140
140
  run(
141
141
  `docker run -d ` +
142
142
  `--name ${CONTAINER} ` +
143
143
  `-p ${port}:5000 ` +
144
- cloudEnv +
144
+ `-e OPSPILOT_CLOUD_URL=${url || 'https://teams.codetop.net'} ` +
145
+ `-e OPSPILOT_CLOUD_TOKEN=${token} ` +
145
146
  `-e OPSPILOT_PORT=5000 ` +
146
147
  `-v ${volArg} ` +
147
148
  `--restart unless-stopped ` +
@@ -219,7 +220,7 @@ function cmdConfig() {
219
220
 
220
221
  function printHelp() {
221
222
  console.log(`
222
- ${BOLD}${CYAN}OpsPilot Local${RESET} — CLI v1.0.0
223
+ ${BOLD}${CYAN}OpsPilot Local${RESET} — CLI v${PKG_VERSION}
223
224
 
224
225
  ${BOLD}Usage:${RESET}
225
226
  opspilot <command> [options]
@@ -233,7 +234,7 @@ ${BOLD}Commands:${RESET}
233
234
  ${CYAN}config${RESET} Show saved local config
234
235
 
235
236
  ${BOLD}Start options:${RESET}
236
- --token <token> License token from OpsPilot Cloud ${YELLOW}(optional — omit to run standalone)${RESET}
237
+ --token <token> License token from OpsPilot Cloud ${YELLOW}(required)${RESET}
237
238
  --cloud-url <url> Cloud server URL [default: https://teams.codetop.net]
238
239
  --port <port> Local port [default: 5000]
239
240
  --data-dir <path> Host data path or Docker volume name [default: opspilot-data]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justin0713/opspilot",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "CLI installer for OpsPilot Local — self-hosted SSH operations platform",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Albert0977/ShellShare#readme",