nstantpage-agent 0.2.1 → 0.2.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.
package/README.md CHANGED
@@ -90,6 +90,7 @@ npx nstantpage-agent start
90
90
  | `-p, --port <port>` | `3000` | Local dev server port |
91
91
  | `-a, --api-port <port>` | `18924` | Internal API port |
92
92
  | `--project-id <id>` | — | Link to a specific project |
93
+ | `--token <token>` | — | Auth token (skip login flow) |
93
94
  | `--gateway <url>` | `wss://webprev.live` | Gateway URL |
94
95
  | `--no-dev` | — | Don't start dev server automatically |
95
96
 
@@ -157,7 +158,9 @@ node dist/cli.js start . --project-id test --gateway ws://localhost:4000
157
158
  ## Troubleshooting
158
159
 
159
160
  ### "Not authenticated" error
160
- Run `npx nstantpage-agent login` to authenticate.
161
+ Run `npx nstantpage-agent login` to authenticate (opens browser).
162
+ Or pass your token directly: `npx nstantpage-agent start --token YOUR_TOKEN --project-id 1234`
163
+ For local gateway testing, auth is skipped automatically when using `--gateway ws://localhost:4000`.
161
164
 
162
165
  ### Port already in use
163
166
  Use `--port` and `--api-port` flags to change ports:
@@ -19,6 +19,15 @@ export async function loginCommand() {
19
19
  const callbackPort = 18923;
20
20
  const token = await new Promise((resolve, reject) => {
21
21
  const server = http.createServer((req, res) => {
22
+ // Allow CORS from nstantpage.com (the auth page uses fetch())
23
+ res.setHeader('Access-Control-Allow-Origin', '*');
24
+ res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
25
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
26
+ if (req.method === 'OPTIONS') {
27
+ res.writeHead(204);
28
+ res.end();
29
+ return;
30
+ }
22
31
  const url = new URL(req.url, `http://localhost:${callbackPort}`);
23
32
  const token = url.searchParams.get('token');
24
33
  if (token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nstantpage-agent",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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": {