inflight-cli 2.11.0 → 2.12.0

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.
@@ -76,12 +76,12 @@ export async function setupCommand(opts = {}) {
76
76
  const alreadyHasWidget = Object.values(context.fileContents).some((c) => c.includes("inflight.co/widget.js"));
77
77
  const scriptTag = `<script src="https://www.inflight.co/widget.js" data-workspace="${widgetId}" async></script>`;
78
78
  const nextSteps = alreadyHasWidget
79
- ? ["Widget already installed. Run `inflight share` to share your staging URL."]
79
+ ? ["Widget already installed. Now run `inflight share` (no arguments) to share the staging URL."]
80
80
  : [
81
81
  "Insert the scriptTag into the project's root layout file, just before </body> (or as the last child of <body> in JSX/TSX files).",
82
82
  "Common locations: app/layout.tsx (Next.js), index.html (Vite/CRA), app/root.tsx (Remix), src/app.html (SvelteKit).",
83
83
  "Commit and push the change so it's included in the next deployment.",
84
- "Then run `inflight share` to share the staging URL for feedback.",
84
+ "Then run `inflight share` (no arguments) to share the staging URL.",
85
85
  ];
86
86
  agentSuccess({
87
87
  workspaceId,
@@ -36,6 +36,13 @@ function isValidHostedUrl(url) {
36
36
  return false;
37
37
  }
38
38
  }
39
+ function appendWidgetToken(url, widgetToken) {
40
+ if (!widgetToken)
41
+ return url;
42
+ const parsed = new URL(url.startsWith("http") ? url : `https://${url}`);
43
+ parsed.searchParams.set("inflight_auth", widgetToken);
44
+ return parsed.toString();
45
+ }
39
46
  /**
40
47
  * Builds a next_command string carrying forward relevant opts from the current run. test
41
48
  */
@@ -420,7 +427,7 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
420
427
  }).catch((e) => {
421
428
  agentError({ type: "create_failed", message: e.message });
422
429
  });
423
- await open(resolvedUrl);
430
+ await open(appendWidgetToken(resolvedUrl, result.widgetToken));
424
431
  agentSuccess({
425
432
  stagingUrl: resolvedUrl,
426
433
  ...result,
@@ -503,7 +510,7 @@ export async function shareCommand(opts = {}) {
503
510
  process.exit(1);
504
511
  });
505
512
  if (isAgent) {
506
- await open(stagingUrl);
513
+ await open(appendWidgetToken(stagingUrl, result.widgetToken));
507
514
  agentSuccess({ stagingUrl, ...result });
508
515
  }
509
516
  if (opts.json) {
@@ -513,7 +520,7 @@ export async function shareCommand(opts = {}) {
513
520
  p.log.info(`Staging URL: ${pc.cyan(stagingUrl)}`);
514
521
  p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
515
522
  }
516
- await open(stagingUrl);
523
+ await open(appendWidgetToken(stagingUrl, result.widgetToken));
517
524
  return;
518
525
  }
519
526
  // ── Agent mode: structured flow with action_required for every choice ──
@@ -637,7 +644,7 @@ export async function shareCommand(opts = {}) {
637
644
  }
638
645
  }
639
646
  }
640
- await apiCreateVersion({
647
+ const result = await apiCreateVersion({
641
648
  apiKey: auth.apiKey,
642
649
  workspaceId,
643
650
  stagingUrl,
@@ -655,5 +662,5 @@ export async function shareCommand(opts = {}) {
655
662
  else {
656
663
  p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
657
664
  }
658
- await open(stagingUrl);
665
+ await open(appendWidgetToken(stagingUrl, result.widgetToken));
659
666
  }
package/dist/lib/api.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface CreateVersionResult {
8
8
  projectId: string;
9
9
  versionId: string;
10
10
  inflightUrl: string;
11
+ widgetToken?: string;
11
12
  }
12
13
  export interface RecentProject {
13
14
  projectId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inflight-cli",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Get feedback directly on your staging URL",
5
5
  "bin": {
6
6
  "inflight": "dist/index.js",