nstantpage-agent 0.2.0 → 0.2.1

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/dist/cli.js CHANGED
@@ -33,6 +33,7 @@ program
33
33
  .option('-a, --api-port <port>', 'Local API server port (internal)', '18924')
34
34
  .option('--project-id <id>', 'Link to a specific project ID')
35
35
  .option('--gateway <url>', 'Gateway URL', 'wss://webprev.live')
36
+ .option('--token <token>', 'Auth token (skip login flow)')
36
37
  .option('--no-dev', 'Skip starting the dev server (start manually later)')
37
38
  .action(startCommand);
38
39
  program
@@ -17,6 +17,7 @@ interface StartOptions {
17
17
  apiPort: string;
18
18
  projectId?: string;
19
19
  gateway: string;
20
+ token?: string;
20
21
  noDev?: boolean;
21
22
  }
22
23
  export declare function startCommand(directory: string, options: StartOptions): Promise<void>;
@@ -20,12 +20,22 @@ import { TunnelClient } from '../tunnel.js';
20
20
  import { LocalServer } from '../localServer.js';
21
21
  export async function startCommand(directory, options) {
22
22
  const conf = getConfig();
23
+ // If --token was passed, persist it
24
+ if (options.token) {
25
+ conf.set('token', options.token);
26
+ }
23
27
  // Check authentication
24
- const token = conf.get('token');
25
- if (!token) {
28
+ // Allow unauthenticated connections to local gateways (ws://localhost, ws://127.0.0.1)
29
+ const isLocalGateway = /^wss?:\/\/(localhost|127\.0\.0\.1)/.test(options.gateway);
30
+ let token = conf.get('token');
31
+ if (!token && !isLocalGateway) {
26
32
  console.log(chalk.red('✗ Not authenticated. Run "nstantpage login" first.'));
33
+ console.log(chalk.gray(' Or pass --token <your-token> to authenticate inline.'));
27
34
  process.exit(1);
28
35
  }
36
+ if (!token && isLocalGateway) {
37
+ token = 'local-dev';
38
+ }
29
39
  // Resolve project directory
30
40
  const projectDir = path.resolve(directory);
31
41
  if (!fs.existsSync(projectDir)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nstantpage-agent",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local development agent for nstantpage.com — run your projects locally, preview in the cloud. Replaces cloud containers for faster builds.",
5
5
  "type": "module",
6
6
  "bin": {