inflight-cli 2.10.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.
- package/dist/commands/setup.js +2 -2
- package/dist/commands/share.d.ts +1 -1
- package/dist/commands/share.js +25 -12
- package/dist/index.js +1 -1
- package/dist/lib/api.d.ts +1 -0
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -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.
|
|
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
|
|
84
|
+
"Then run `inflight share` (no arguments) to share the staging URL.",
|
|
85
85
|
];
|
|
86
86
|
agentSuccess({
|
|
87
87
|
workspaceId,
|
package/dist/commands/share.d.ts
CHANGED
package/dist/commands/share.js
CHANGED
|
@@ -36,8 +36,15 @@ 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
|
-
* Builds a next_command string carrying forward relevant opts from the current run.
|
|
47
|
+
* Builds a next_command string carrying forward relevant opts from the current run. test
|
|
41
48
|
*/
|
|
42
49
|
function buildNextCommand(base, opts) {
|
|
43
50
|
const parts = [base];
|
|
@@ -49,8 +56,8 @@ function buildNextCommand(base, opts) {
|
|
|
49
56
|
parts.push(`--deployment ${opts.deployment}`);
|
|
50
57
|
if (opts.project)
|
|
51
58
|
parts.push(`--project ${opts.project}`);
|
|
52
|
-
if (opts.
|
|
53
|
-
parts.push(
|
|
59
|
+
if (opts.versionMode)
|
|
60
|
+
parts.push(`--version-mode ${opts.versionMode}`);
|
|
54
61
|
return parts.join(" ");
|
|
55
62
|
}
|
|
56
63
|
/**
|
|
@@ -357,7 +364,9 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
|
|
|
357
364
|
id: proj.projectId,
|
|
358
365
|
label: proj.latestVersion.title,
|
|
359
366
|
hint: [
|
|
360
|
-
proj.latestVersion.branch === currentBranch
|
|
367
|
+
proj.latestVersion.branch === currentBranch
|
|
368
|
+
? "current branch"
|
|
369
|
+
: proj.latestVersion.branch,
|
|
361
370
|
proj.latestVersion.branch === currentBranch ? "(recommended)" : undefined,
|
|
362
371
|
]
|
|
363
372
|
.filter(Boolean)
|
|
@@ -369,7 +378,7 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
|
|
|
369
378
|
}
|
|
370
379
|
}
|
|
371
380
|
// ── Resolve override vs new version ──
|
|
372
|
-
if (selectedProjectId && !opts.
|
|
381
|
+
if (selectedProjectId && !opts.versionMode) {
|
|
373
382
|
const { projects } = await apiGetRecentProjects(apiKey, workspaceId, 20).catch(() => ({
|
|
374
383
|
projects: [],
|
|
375
384
|
}));
|
|
@@ -390,11 +399,15 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
|
|
|
390
399
|
hint: "keep both in version history",
|
|
391
400
|
},
|
|
392
401
|
],
|
|
393
|
-
|
|
402
|
+
instructions: {
|
|
403
|
+
override: `Re-run with: inflight share --skip-git-check --deployment ${resolvedUrl} --project ${selectedProjectId} --version-mode override`,
|
|
404
|
+
new_version: `Re-run with: inflight share --skip-git-check --deployment ${resolvedUrl} --project ${selectedProjectId} --version-mode new`,
|
|
405
|
+
},
|
|
406
|
+
nextCommand: `inflight share --skip-git-check --deployment ${resolvedUrl} --project ${selectedProjectId} --version-mode <override|new>`,
|
|
394
407
|
});
|
|
395
408
|
}
|
|
396
409
|
}
|
|
397
|
-
if (opts.override && selectedProjectId) {
|
|
410
|
+
if (opts.versionMode === "override" && selectedProjectId) {
|
|
398
411
|
const { projects } = await apiGetRecentProjects(apiKey, workspaceId, 20).catch(() => ({
|
|
399
412
|
projects: [],
|
|
400
413
|
}));
|
|
@@ -414,7 +427,7 @@ async function agentShareFlow(cwd, apiKey, workspaceId, opts) {
|
|
|
414
427
|
}).catch((e) => {
|
|
415
428
|
agentError({ type: "create_failed", message: e.message });
|
|
416
429
|
});
|
|
417
|
-
await open(resolvedUrl);
|
|
430
|
+
await open(appendWidgetToken(resolvedUrl, result.widgetToken));
|
|
418
431
|
agentSuccess({
|
|
419
432
|
stagingUrl: resolvedUrl,
|
|
420
433
|
...result,
|
|
@@ -497,7 +510,7 @@ export async function shareCommand(opts = {}) {
|
|
|
497
510
|
process.exit(1);
|
|
498
511
|
});
|
|
499
512
|
if (isAgent) {
|
|
500
|
-
await open(stagingUrl);
|
|
513
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
501
514
|
agentSuccess({ stagingUrl, ...result });
|
|
502
515
|
}
|
|
503
516
|
if (opts.json) {
|
|
@@ -507,7 +520,7 @@ export async function shareCommand(opts = {}) {
|
|
|
507
520
|
p.log.info(`Staging URL: ${pc.cyan(stagingUrl)}`);
|
|
508
521
|
p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
|
|
509
522
|
}
|
|
510
|
-
await open(stagingUrl);
|
|
523
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
511
524
|
return;
|
|
512
525
|
}
|
|
513
526
|
// ── Agent mode: structured flow with action_required for every choice ──
|
|
@@ -631,7 +644,7 @@ export async function shareCommand(opts = {}) {
|
|
|
631
644
|
}
|
|
632
645
|
}
|
|
633
646
|
}
|
|
634
|
-
await apiCreateVersion({
|
|
647
|
+
const result = await apiCreateVersion({
|
|
635
648
|
apiKey: auth.apiKey,
|
|
636
649
|
workspaceId,
|
|
637
650
|
stagingUrl,
|
|
@@ -649,5 +662,5 @@ export async function shareCommand(opts = {}) {
|
|
|
649
662
|
else {
|
|
650
663
|
p.outro(pc.green("✓ Inflight added to your staging URL") + " — opening in browser...");
|
|
651
664
|
}
|
|
652
|
-
await open(stagingUrl);
|
|
665
|
+
await open(appendWidgetToken(stagingUrl, result.widgetToken));
|
|
653
666
|
}
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ program
|
|
|
34
34
|
.option("--project <id>", "Project ID, or 'new' to create")
|
|
35
35
|
.option("--provider <id>", "Deployment provider: vercel, netlify")
|
|
36
36
|
.option("--deployment <url>", "Specific deployment URL")
|
|
37
|
-
.option("--
|
|
37
|
+
.option("--version-mode <mode>", "Version handling: 'override' or 'new'")
|
|
38
38
|
.option("--skip-git-check", "Skip git state check (use after agent handled git)")
|
|
39
39
|
.action((opts) => shareCommand(opts));
|
|
40
40
|
program
|
package/dist/lib/api.d.ts
CHANGED