@justin0713/opspilot 1.0.0 → 1.0.2

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 +21 -20
  2. package/package.json +1 -1
package/bin/opspilot.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * Wraps Docker to pull, run, update, and manage the OpsPilot Local container.
7
7
  *
8
8
  * Usage:
9
- * npx opspilot start --token <license-token>
9
+ * npx @justin0713/opspilot start --token <license-token>
10
10
  * opspilot start --token <token> --port 5000
11
11
  * opspilot stop
12
12
  * opspilot logs [-f]
@@ -100,22 +100,19 @@ function cmdStart(flags) {
100
100
  checkDocker();
101
101
 
102
102
  const cfg = loadConfig();
103
- const token = flags.token || cfg.token || '';
104
- const url = flags['cloud-url'] || cfg.cloudUrl || 'https://teams.codetop.net';
105
- const port = flags.port || cfg.port || '5000';
106
- const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
107
-
108
- if (!token) {
109
- die(
110
- 'License token required.\n' +
111
- ' opspilot start --token <your-license-token>\n' +
112
- ' Get a token at: https://teams.codetop.net/dashboard'
113
- );
103
+ const token = flags.token || cfg.token || '';
104
+ const url = flags['cloud-url'] || cfg.cloudUrl || '';
105
+ const port = flags.port || cfg.port || '5000';
106
+ const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
107
+
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 });
114
114
  }
115
115
 
116
- // Persist for next run
117
- saveConfig({ token, cloudUrl: url, port, dataDir: data });
118
-
119
116
  // Stop existing container if running
120
117
  const existing = tryRun(`docker inspect -f "{{.State.Status}}" ${CONTAINER} 2>/dev/null`);
121
118
  if (existing === 'running') {
@@ -132,15 +129,19 @@ function cmdStart(flags) {
132
129
 
133
130
  // Volume arg: named volume or host path
134
131
  const isAbsolute = path.isAbsolute(data);
135
- const volArg = isAbsolute ? `${data}:/app/data` : `${data}:/app/data`;
132
+ const volArg = `${data}:/app/data`;
133
+
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
+ : '';
136
138
 
137
139
  log(`Starting OpsPilot Local on port ${port} ...`);
138
140
  run(
139
141
  `docker run -d ` +
140
142
  `--name ${CONTAINER} ` +
141
143
  `-p ${port}:5000 ` +
142
- `-e OPSPILOT_CLOUD_URL=${url} ` +
143
- `-e OPSPILOT_CLOUD_TOKEN=${token} ` +
144
+ cloudEnv +
144
145
  `-e OPSPILOT_PORT=5000 ` +
145
146
  `-v ${volArg} ` +
146
147
  `--restart unless-stopped ` +
@@ -232,13 +233,13 @@ ${BOLD}Commands:${RESET}
232
233
  ${CYAN}config${RESET} Show saved local config
233
234
 
234
235
  ${BOLD}Start options:${RESET}
235
- --token <token> License token from OpsPilot Cloud ${YELLOW}(required on first run)${RESET}
236
+ --token <token> License token from OpsPilot Cloud ${YELLOW}(optional omit to run standalone)${RESET}
236
237
  --cloud-url <url> Cloud server URL [default: https://teams.codetop.net]
237
238
  --port <port> Local port [default: 5000]
238
239
  --data-dir <path> Host data path or Docker volume name [default: opspilot-data]
239
240
 
240
241
  ${BOLD}Examples:${RESET}
241
- npx opspilot start --token eyJ...
242
+ npx @justin0713/opspilot start --token eyJ...
242
243
  opspilot start --token eyJ... --port 8080
243
244
  opspilot logs -f
244
245
  opspilot update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justin0713/opspilot",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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",