@paradigma-inc/flywheel 0.1.60 → 0.1.72
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 +35 -14
- package/package.json +4 -2
- package/skills/flywheel/SKILL.md +4 -3
- package/skills/flywheel/getting-started/flywheel-quickstart.md +4 -4
- package/skills/flywheel/references/flywheel-cli-tool-map.md +40 -36
- package/skills/flywheel/references/flywheel-mcp-tool-map.md +8 -5
- package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +3 -3
- package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +3 -3
- package/skills/flywheel/setting-up-flywheel/installation-overview.md +9 -8
- package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +1 -1
- package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +4 -4
- package/skills/flywheel-auto/SKILL.md +4 -3
- package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +37 -35
- package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +4 -4
- package/skills/flywheel-lookahead/SKILL.md +1 -1
- package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +37 -35
- package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +4 -4
- package/skills/flywheel-prove/SKILL.md +1 -1
- package/skills/flywheel-reproduce/SKILL.md +4 -3
- package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +37 -35
- package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +4 -4
- package/skills/flywheel-to-graph/SKILL.md +1 -1
- package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +37 -35
- package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +4 -4
- package/skills/flywheel-tree/SKILL.md +1 -1
- package/src/cli.mjs +111 -26
- package/src/runtime/required-runtime-commands.json +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +3 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.js +23 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +6 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +21 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.js +51 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js +6 -3
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.js +18 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.js +6 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.js +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.js +49 -13
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.js +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.js +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.js +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.js +2 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +18 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.js +38 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +4 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.js +42 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +15 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.js +8 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.js +6 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.js +18 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.js +8 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.js +8 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.js +8 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.js +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/enums.js +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/enums.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.js +12 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.js +9 -14
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +31 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.js +69 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +4 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +181 -129
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +4 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.js +7 -3
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.js +6 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +6 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +8 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.js +55 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +13 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +16 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.js +8 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +14 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.js +8 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.js +29 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +13 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.js +11 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.js +2 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.js +8 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.js +6 -14
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.js +193 -125
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.js +22 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +123 -11
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.js +12 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +42 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.js +20 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.js +23 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +15 -0
- package/src/runtime/vendor/flywheel-cli-dist/errors.js +16 -1
- package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js +75 -19
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +3 -0
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +21 -2
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/main.js +118 -9
- package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js +44 -6
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
- package/src/runtime/vendor/manifest.json +22 -1
- package/src/setup/base-url.mjs +43 -0
- package/src/setup/command.mjs +2 -0
- package/src/setup/modes/cli.mjs +33 -10
- package/src/setup/modes/mcp-command.mjs +48 -19
- package/src/setup/resolved-selection-record.mjs +25 -0
- package/src/setup-auth.mjs +3 -2
package/src/cli.mjs
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
resolvePackageRoot,
|
|
38
38
|
} from "./skill-installer.mjs";
|
|
39
39
|
import { normalizeSetupAuthMode } from "./setup-auth.mjs";
|
|
40
|
+
import { resolveSetupBaseUrl } from "./setup/base-url.mjs";
|
|
40
41
|
import { runSetupRouter } from "./setup/command.mjs";
|
|
41
42
|
import { SetupModeUsageError } from "./setup/mode.mjs";
|
|
42
43
|
import { runCliSetupMode } from "./setup/modes/cli.mjs";
|
|
@@ -58,9 +59,6 @@ async function pathExists(targetPath) {
|
|
|
58
59
|
|
|
59
60
|
export { buildGuidedSkillInstallPrompt };
|
|
60
61
|
|
|
61
|
-
const INSTALL_SKILL_BASE_URL = "https://flywheel.paradigma.inc";
|
|
62
|
-
const DEFAULT_BASE_URL =
|
|
63
|
-
process.env.FLYWHEEL_PUBLIC_BASE_URL || INSTALL_SKILL_BASE_URL;
|
|
64
62
|
const log = {
|
|
65
63
|
info: (message) => console.log(pc.cyan(message)),
|
|
66
64
|
warn: (message) => console.log(pc.yellow(`⚠ ${message}`)),
|
|
@@ -76,6 +74,12 @@ const CHECKBOX_THEME = {
|
|
|
76
74
|
},
|
|
77
75
|
};
|
|
78
76
|
|
|
77
|
+
function hostChoiceDescription({ detected = false, configured = false } = {}) {
|
|
78
|
+
if (configured) return "Already has a Flywheel entry for this scope.";
|
|
79
|
+
if (detected) return "Detected on this machine.";
|
|
80
|
+
return "Supported host; select it if you use it here.";
|
|
81
|
+
}
|
|
82
|
+
|
|
79
83
|
function normalizeBaseUrl(value) {
|
|
80
84
|
const normalized = String(value || "").trim();
|
|
81
85
|
let parsedUrl;
|
|
@@ -225,6 +229,11 @@ async function promptHosts(
|
|
|
225
229
|
return {
|
|
226
230
|
name: SETUP_HOST_NAMES[hostName],
|
|
227
231
|
value: hostName,
|
|
232
|
+
short: SETUP_HOST_NAMES[hostName],
|
|
233
|
+
description: hostChoiceDescription({
|
|
234
|
+
detected: detected.includes(hostName),
|
|
235
|
+
configured,
|
|
236
|
+
}),
|
|
228
237
|
checked: detected.includes(hostName),
|
|
229
238
|
disabled:
|
|
230
239
|
disableAlreadyConfigured && configured
|
|
@@ -295,15 +304,23 @@ export function buildSetupModePromptConfig() {
|
|
|
295
304
|
message: "How should your agent access Flywheel?",
|
|
296
305
|
choices: [
|
|
297
306
|
{
|
|
298
|
-
name:
|
|
307
|
+
name: "MCP + bundled skills",
|
|
299
308
|
value: "mcp",
|
|
309
|
+
short: "MCP + skills",
|
|
310
|
+
description:
|
|
311
|
+
"Configure MCP tools plus bundled skills for supported AI hosts.",
|
|
300
312
|
},
|
|
301
313
|
{
|
|
302
|
-
name:
|
|
314
|
+
name: "CLI + bundled skills",
|
|
303
315
|
value: "cli",
|
|
316
|
+
short: "CLI + skills",
|
|
317
|
+
description:
|
|
318
|
+
"Install bundled skills for agents that call the flywheel binary.",
|
|
304
319
|
},
|
|
305
320
|
],
|
|
306
321
|
default: "mcp",
|
|
322
|
+
loop: false,
|
|
323
|
+
pageSize: 4,
|
|
307
324
|
theme: CHECKBOX_THEME,
|
|
308
325
|
};
|
|
309
326
|
}
|
|
@@ -347,7 +364,9 @@ function validateCliModeFlags(options) {
|
|
|
347
364
|
async function runCliModeCommand(options) {
|
|
348
365
|
validateCliModeFlags(options);
|
|
349
366
|
const scope = options.project ? "project" : "global";
|
|
350
|
-
const baseUrl = normalizeBaseUrl(
|
|
367
|
+
const baseUrl = normalizeBaseUrl(
|
|
368
|
+
resolveSetupBaseUrl({ explicitBaseUrl: options.baseUrl }),
|
|
369
|
+
);
|
|
351
370
|
const serverUrl = `${baseUrl}/mcp-server`;
|
|
352
371
|
const serverName = normalizeServerName(options.name || SERVER_NAME);
|
|
353
372
|
const hosts = await resolveHosts(options, scope, serverName, {
|
|
@@ -420,7 +439,8 @@ async function runCliModeCommand(options) {
|
|
|
420
439
|
|
|
421
440
|
async function runSetupCommandViaRouter(options) {
|
|
422
441
|
return await runSetupRouter(options, {
|
|
423
|
-
isInteractive:
|
|
442
|
+
isInteractive:
|
|
443
|
+
process.stdin.isTTY === true && process.stdout.isTTY === true,
|
|
424
444
|
promptMode: promptSetupMode,
|
|
425
445
|
runMcpMode: async () =>
|
|
426
446
|
await runMcpModeCommand(options, {
|
|
@@ -500,8 +520,12 @@ function readConfigSection(config, configKey) {
|
|
|
500
520
|
|
|
501
521
|
function parseTomlServerNames(tomlText) {
|
|
502
522
|
const serverNames = new Set();
|
|
503
|
-
for (const line of String(tomlText || "")
|
|
504
|
-
|
|
523
|
+
for (const line of String(tomlText || "")
|
|
524
|
+
.replace(/\r\n/g, "\n")
|
|
525
|
+
.split("\n")) {
|
|
526
|
+
const match = line
|
|
527
|
+
.trim()
|
|
528
|
+
.match(/^\[mcp_servers\.([A-Za-z0-9_-]+)\](?:\s*#.*)?$/);
|
|
505
529
|
if (!match) {
|
|
506
530
|
continue;
|
|
507
531
|
}
|
|
@@ -557,7 +581,10 @@ async function listHostMcpEntries(hostName, scope) {
|
|
|
557
581
|
: await readJsonConfig(filePath);
|
|
558
582
|
const section = readConfigSection(config, host.mcp.configKey);
|
|
559
583
|
return Object.entries(section)
|
|
560
|
-
.filter(
|
|
584
|
+
.filter(
|
|
585
|
+
([, entry]) =>
|
|
586
|
+
entry && typeof entry === "object" && !Array.isArray(entry),
|
|
587
|
+
)
|
|
561
588
|
.map(([serverName, entry]) => ({
|
|
562
589
|
serverName,
|
|
563
590
|
url: readEntryServerUrl(entry),
|
|
@@ -568,7 +595,9 @@ async function resolveHostsWithRemainingFlywheelMcpEntries({ scope }) {
|
|
|
568
595
|
const remainingHosts = [];
|
|
569
596
|
for (const hostName of SUPPORTED_INSTALL_SKILL_HOSTS) {
|
|
570
597
|
// eslint-disable-next-line no-await-in-loop
|
|
571
|
-
const hostEntries = await listHostMcpEntries(hostName, scope).catch(
|
|
598
|
+
const hostEntries = await listHostMcpEntries(hostName, scope).catch(
|
|
599
|
+
() => [],
|
|
600
|
+
);
|
|
572
601
|
if (hostEntries.some((entry) => isLikelyFlywheelMcpUrl(entry.url))) {
|
|
573
602
|
remainingHosts.push(hostName);
|
|
574
603
|
}
|
|
@@ -981,10 +1010,12 @@ async function runUninstallCommand(options) {
|
|
|
981
1010
|
scope: singleScope,
|
|
982
1011
|
});
|
|
983
1012
|
// eslint-disable-next-line no-await-in-loop
|
|
984
|
-
const skillOnlyRetained = await resolveSkillOnlyHostsRetainingArtifacts(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1013
|
+
const skillOnlyRetained = await resolveSkillOnlyHostsRetainingArtifacts(
|
|
1014
|
+
{
|
|
1015
|
+
scope: singleScope,
|
|
1016
|
+
excludedHostNames: supportedHosts,
|
|
1017
|
+
},
|
|
1018
|
+
);
|
|
988
1019
|
const configuredRetainHostNames = [
|
|
989
1020
|
...new Set([...mcpRetained, ...skillOnlyRetained]),
|
|
990
1021
|
];
|
|
@@ -1018,7 +1049,9 @@ async function runUninstallCommand(options) {
|
|
|
1018
1049
|
}
|
|
1019
1050
|
|
|
1020
1051
|
log.blank();
|
|
1021
|
-
log.plain(
|
|
1052
|
+
log.plain(
|
|
1053
|
+
pc.green("✔ Flywheel uninstall complete (MCP entries and bundled skills)"),
|
|
1054
|
+
);
|
|
1022
1055
|
log.blank();
|
|
1023
1056
|
for (const result of mcpResults) {
|
|
1024
1057
|
const icon = result.status === "removed" ? pc.green("-") : pc.dim("~");
|
|
@@ -1051,11 +1084,13 @@ async function runUninstallCommand(options) {
|
|
|
1051
1084
|
}
|
|
1052
1085
|
}
|
|
1053
1086
|
|
|
1054
|
-
const sortedGroups = [...groupedSkillResults.values()].sort(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1087
|
+
const sortedGroups = [...groupedSkillResults.values()].sort(
|
|
1088
|
+
(left, right) => {
|
|
1089
|
+
const leftKey = `${left.hostName}:${left.scope}`;
|
|
1090
|
+
const rightKey = `${right.hostName}:${right.scope}`;
|
|
1091
|
+
return leftKey.localeCompare(rightKey);
|
|
1092
|
+
},
|
|
1093
|
+
);
|
|
1059
1094
|
for (const groupedResult of sortedGroups) {
|
|
1060
1095
|
log.plain(
|
|
1061
1096
|
` ${pc.bold(getHost(groupedResult.hostName).displayName)} ${pc.dim(`(${groupedResult.scope})`)}`,
|
|
@@ -1071,7 +1106,9 @@ async function runUninstallCommand(options) {
|
|
|
1071
1106
|
entry.status === "retained" && Array.isArray(entry.retainedHostNames)
|
|
1072
1107
|
? ` (shared with configured host(s): ${entry.retainedHostNames.join(", ")})`
|
|
1073
1108
|
: "";
|
|
1074
|
-
log.plain(
|
|
1109
|
+
log.plain(
|
|
1110
|
+
` ${icon} ${entry.status}${retainedSuffix}: ${entry.skillNames.join(", ")}`,
|
|
1111
|
+
);
|
|
1075
1112
|
log.plain(` ${pc.dim(entry.installedSkillDir)}`);
|
|
1076
1113
|
}
|
|
1077
1114
|
}
|
|
@@ -1082,7 +1119,9 @@ async function runUninstallCommand(options) {
|
|
|
1082
1119
|
log.plain(
|
|
1083
1120
|
` ${pc.bold(getHost(unsupportedHostName).displayName)} ${pc.dim(`(${singleScope})`)}`,
|
|
1084
1121
|
);
|
|
1085
|
-
log.plain(
|
|
1122
|
+
log.plain(
|
|
1123
|
+
` ${pc.dim("~")} skill uninstall not supported (MCP-only host)`,
|
|
1124
|
+
);
|
|
1086
1125
|
}
|
|
1087
1126
|
}
|
|
1088
1127
|
log.blank();
|
|
@@ -1110,6 +1149,13 @@ Examples:
|
|
|
1110
1149
|
program
|
|
1111
1150
|
.command("setup")
|
|
1112
1151
|
.description("Set up Flywheel for your AI coding host")
|
|
1152
|
+
.addHelpText(
|
|
1153
|
+
"before",
|
|
1154
|
+
`${pc.bold(pc.cyan("✻ Flywheel Setup"))}
|
|
1155
|
+
|
|
1156
|
+
Configure the Flywheel CLI, MCP host entries, and bundled skills without changing command names or setup modes.
|
|
1157
|
+
`,
|
|
1158
|
+
)
|
|
1113
1159
|
.optionsGroup("Hosts:")
|
|
1114
1160
|
.option("--claude", "Set up for Claude Code")
|
|
1115
1161
|
.option("--cursor", "Set up for Cursor")
|
|
@@ -1151,17 +1197,43 @@ Examples:
|
|
|
1151
1197
|
)
|
|
1152
1198
|
.option(
|
|
1153
1199
|
"--base-url <url>",
|
|
1154
|
-
`Public Flywheel origin used for setup and MCP config (default: ${
|
|
1200
|
+
`Public Flywheel origin used for setup and MCP config (default: ${resolveSetupBaseUrl()})`,
|
|
1155
1201
|
)
|
|
1156
1202
|
.option("--name <name>", `MCP server name (default: ${SERVER_NAME})`)
|
|
1157
|
-
.option(
|
|
1203
|
+
.option(
|
|
1204
|
+
"--force",
|
|
1205
|
+
"Reconcile prior install mode automatically via uninstall",
|
|
1206
|
+
)
|
|
1207
|
+
.addHelpText(
|
|
1208
|
+
"after",
|
|
1209
|
+
`
|
|
1210
|
+
Examples:
|
|
1211
|
+
${pc.green("npx --yes @paradigma-inc/flywheel setup --mode mcp --install-skill")}
|
|
1212
|
+
${pc.green("npx --yes @paradigma-inc/flywheel setup --mode mcp --skip-skill --codex --project")}
|
|
1213
|
+
${pc.green("npx --yes @paradigma-inc/flywheel setup --mode cli --codex --project")}
|
|
1214
|
+
|
|
1215
|
+
Next steps:
|
|
1216
|
+
${pc.green("flywheel help")}
|
|
1217
|
+
${pc.green("flywheel auth:status")}
|
|
1218
|
+
`,
|
|
1219
|
+
)
|
|
1158
1220
|
.action(async (options) => {
|
|
1159
1221
|
await runSetupCommandViaRouter(options);
|
|
1160
1222
|
});
|
|
1161
1223
|
|
|
1162
1224
|
program
|
|
1163
1225
|
.command("uninstall")
|
|
1164
|
-
.description(
|
|
1226
|
+
.description(
|
|
1227
|
+
"Remove Flywheel MCP entries and bundled skills from selected hosts",
|
|
1228
|
+
)
|
|
1229
|
+
.addHelpText(
|
|
1230
|
+
"before",
|
|
1231
|
+
`${pc.bold(pc.cyan("✻ Flywheel Uninstall"))}
|
|
1232
|
+
|
|
1233
|
+
Remove Flywheel MCP entries and bundled skills from selected hosts without changing command names or uninstall scopes.
|
|
1234
|
+
`,
|
|
1235
|
+
)
|
|
1236
|
+
.optionsGroup("Hosts:")
|
|
1165
1237
|
.option("--claude", "Uninstall for Claude Code")
|
|
1166
1238
|
.option("--cursor", "Uninstall for Cursor")
|
|
1167
1239
|
.option("--universal", "Uninstall bundled skills from .agents/skills")
|
|
@@ -1172,6 +1244,7 @@ Examples:
|
|
|
1172
1244
|
.option("--pi-mono", "Uninstall for Pi (pi-mono)")
|
|
1173
1245
|
.option("--hermes-agent", "Uninstall for Hermes Agent")
|
|
1174
1246
|
.option("--openclaw", "Uninstall for OpenClaw")
|
|
1247
|
+
.optionsGroup("Selection:")
|
|
1175
1248
|
.option(
|
|
1176
1249
|
"--hosts <list>",
|
|
1177
1250
|
"Comma-separated: claude,cursor,universal,antigravity,opencode,codex,gemini,pi-mono,hermes-agent,openclaw",
|
|
@@ -1182,6 +1255,18 @@ Examples:
|
|
|
1182
1255
|
`MCP server name to remove (default: ${SERVER_NAME})`,
|
|
1183
1256
|
)
|
|
1184
1257
|
.option("-y, --yes", "Skip uninstall selection prompts")
|
|
1258
|
+
.addHelpText(
|
|
1259
|
+
"after",
|
|
1260
|
+
`
|
|
1261
|
+
Examples:
|
|
1262
|
+
${pc.green("npx --yes @paradigma-inc/flywheel uninstall --codex --scope project")}
|
|
1263
|
+
${pc.green("npx --yes @paradigma-inc/flywheel uninstall --hosts claude,codex --scope all --yes")}
|
|
1264
|
+
|
|
1265
|
+
Next steps:
|
|
1266
|
+
${pc.green("flywheel help setup")}
|
|
1267
|
+
${pc.green("npx --yes @paradigma-inc/flywheel setup --mode mcp")}
|
|
1268
|
+
`,
|
|
1269
|
+
)
|
|
1185
1270
|
.action(async (options) => {
|
|
1186
1271
|
await runUninstallCommand(options);
|
|
1187
1272
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestOptions } from './types.js';
|
|
1
|
+
import type { CommandContext, RequestOptions } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Build the admin-only auth overlay for `RequestOptions` from the
|
|
4
4
|
* ``FLYWHEEL_ADMIN_KEY`` env var and the caller's configured bearer.
|
|
@@ -23,3 +23,5 @@ import type { RequestOptions } from './types.js';
|
|
|
23
23
|
* chain (JWT or API key) flows through untouched.
|
|
24
24
|
*/
|
|
25
25
|
export declare function adminAuthRequestOptions(apiKey?: string): Pick<RequestOptions, 'extraHeaders' | 'skipAuth'>;
|
|
26
|
+
export declare function adminKeyFromEnv(): string | undefined;
|
|
27
|
+
export declare function requireAdminCredential(context: CommandContext, commandName: string): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CliAuthRequirementError } from '../errors.js';
|
|
2
|
+
import { activeCredentialIsApiKey } from './auth-mode.js';
|
|
1
3
|
/**
|
|
2
4
|
* Build the admin-only auth overlay for `RequestOptions` from the
|
|
3
5
|
* ``FLYWHEEL_ADMIN_KEY`` env var and the caller's configured bearer.
|
|
@@ -22,14 +24,31 @@
|
|
|
22
24
|
* chain (JWT or API key) flows through untouched.
|
|
23
25
|
*/
|
|
24
26
|
export function adminAuthRequestOptions(apiKey) {
|
|
25
|
-
const key =
|
|
26
|
-
if (
|
|
27
|
-
const bearerIsApiKey =
|
|
27
|
+
const key = adminKeyFromEnv();
|
|
28
|
+
if (key) {
|
|
29
|
+
const bearerIsApiKey = activeCredentialIsApiKey(apiKey);
|
|
28
30
|
return {
|
|
29
|
-
extraHeaders: { 'X-Admin-Key': key
|
|
31
|
+
extraHeaders: { 'X-Admin-Key': key },
|
|
30
32
|
...(bearerIsApiKey ? { skipAuth: true } : {}),
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
return { extraHeaders: {} };
|
|
34
36
|
}
|
|
37
|
+
export function adminKeyFromEnv() {
|
|
38
|
+
const key = process.env.FLYWHEEL_ADMIN_KEY?.trim();
|
|
39
|
+
return key || undefined;
|
|
40
|
+
}
|
|
41
|
+
export function requireAdminCredential(context, commandName) {
|
|
42
|
+
if (adminKeyFromEnv()) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (context.apiKey && !activeCredentialIsApiKey(context.apiKey)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
throw new CliAuthRequirementError(`${commandName} requires admin credentials. Set FLYWHEEL_ADMIN_KEY or use a browser session with admin access.`, {
|
|
49
|
+
code: 'admin_auth_required',
|
|
50
|
+
commandName,
|
|
51
|
+
nextAction: 'Set FLYWHEEL_ADMIN_KEY for this invocation or sign in with a browser session that has admin access.',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
35
54
|
//# sourceMappingURL=_admin-auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_admin-auth.js","sourceRoot":"","sources":["../../src/commands/_admin-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_admin-auth.js","sourceRoot":"","sources":["../../src/commands/_admin-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAe;IAEf,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAC9B,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,cAAc,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO;YACL,YAAY,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE;YACpC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,GAAG,IAAI,SAAS,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAuB,EACvB,WAAmB;IAEnB,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChE,OAAO;IACT,CAAC;IACD,MAAM,IAAI,uBAAuB,CAC/B,GAAG,WAAW,iGAAiG,EAC/G;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW;QACX,UAAU,EACR,qGAAqG;KACxG,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -18,7 +18,7 @@ interface ResolvedUpload {
|
|
|
18
18
|
* Content-Length headers when streaming. */
|
|
19
19
|
size: number;
|
|
20
20
|
}
|
|
21
|
-
export declare function parseItems(params: Record<string, string | boolean>): UploadItem[]
|
|
21
|
+
export declare function parseItems(params: Record<string, string | boolean>): Promise<UploadItem[]>;
|
|
22
22
|
/**
|
|
23
23
|
* Validate the batch against per-file size and existence rules. Reads
|
|
24
24
|
* **metadata only** (`fs.stat`) — file bodies are deliberately not loaded
|
|
@@ -3,7 +3,8 @@ import path from 'node:path';
|
|
|
3
3
|
import { CliFinalizeFailedError, CliUsageError } from '../errors.js';
|
|
4
4
|
import { EXIT_TRANSPORT } from '../exit-codes.js';
|
|
5
5
|
import { CliHttpError } from '../http/client.js';
|
|
6
|
-
import {
|
|
6
|
+
import { redactExternalUrlForOutput } from '../http/debug.js';
|
|
7
|
+
import { requiredInt, requiredString, resolvePayloadJson } from './utils.js';
|
|
7
8
|
const ARTIFACT_TYPES = new Set([
|
|
8
9
|
'text', 'table', 'json', 'image', 'banner',
|
|
9
10
|
'html', 'plotly_html', 'vega', 'checkpoint', 'binary', 'diff_carousel',
|
|
@@ -28,8 +29,8 @@ function detectMediaType(filename) {
|
|
|
28
29
|
default: return 'application/octet-stream';
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
export function parseItems(params) {
|
|
32
|
-
const raw =
|
|
32
|
+
export async function parseItems(params) {
|
|
33
|
+
const raw = await resolvePayloadJson(params, 'items');
|
|
33
34
|
if (!Array.isArray(raw) || raw.length === 0) {
|
|
34
35
|
throw new CliUsageError('items must be a non-empty JSON array');
|
|
35
36
|
}
|
|
@@ -93,7 +94,7 @@ export async function validateItems(items) {
|
|
|
93
94
|
export async function runArtifactsUpload(context) {
|
|
94
95
|
const nodeId = requiredString(context.params, 'node_id');
|
|
95
96
|
const expectedRevision = requiredInt(context.params, 'expected_revision');
|
|
96
|
-
const items = parseItems(context.params);
|
|
97
|
+
const items = await parseItems(context.params);
|
|
97
98
|
const resolved = await validateItems(items);
|
|
98
99
|
if (!context.requestRawExternal) {
|
|
99
100
|
throw new CliUsageError('binary external transport unavailable in this context');
|
|
@@ -155,7 +156,7 @@ export async function runArtifactsUpload(context) {
|
|
|
155
156
|
// Using CliHttpError (exit 2) keeps the upload path consistent with
|
|
156
157
|
// every other HTTP error and lets script retry-on-transport loops
|
|
157
158
|
// treat it uniformly.
|
|
158
|
-
throw new CliHttpError(`upload PUT failed for ${item.local_path} with status ${response.status}`, EXIT_TRANSPORT, response.status, undefined, { method: 'PUT', path: batchItem.upload_url });
|
|
159
|
+
throw new CliHttpError(`upload PUT failed for ${item.local_path} with status ${response.status}`, EXIT_TRANSPORT, response.status, undefined, { method: 'PUT', path: redactExternalUrlForOutput(batchItem.upload_url) });
|
|
159
160
|
}
|
|
160
161
|
if (batchItem.upload_id)
|
|
161
162
|
orphanBlobIds.push(batchItem.upload_id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_artifacts-upload-helpers.js","sourceRoot":"","sources":["../../src/commands/_artifacts-upload-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"_artifacts-upload-helpers.js","sourceRoot":"","sources":["../../src/commands/_artifacts-upload-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;IAC1C,MAAM,EAAE,aAAa,EAAE,MA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,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAC/D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,sBAAsB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CliGlobals } from '../grammar/globals.js';
|
|
2
|
+
export interface BrowserHandoffResult {
|
|
3
|
+
status: 'browser_flow_required';
|
|
4
|
+
command: string;
|
|
5
|
+
url: string;
|
|
6
|
+
opened: boolean;
|
|
7
|
+
next_action: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes route-specific browser URLs into the CLI's stable handoff result.
|
|
11
|
+
* Billing routes expose Stripe-shaped checkout/portal fields, while OAuth and
|
|
12
|
+
* generic handoffs use open_url/url.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractOpenUrl(payload: Record<string, unknown>): string;
|
|
15
|
+
export declare function buildBrowserHandoffResult({ command, url, globals, stderr, nextAction, }: {
|
|
16
|
+
command: string;
|
|
17
|
+
url: string;
|
|
18
|
+
globals: CliGlobals | undefined;
|
|
19
|
+
stderr?: (chunk: string) => void;
|
|
20
|
+
nextAction: string;
|
|
21
|
+
}): Promise<BrowserHandoffResult>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EXIT_TRANSPORT } from '../exit-codes.js';
|
|
2
|
+
import { CliHttpError } from '../http/client.js';
|
|
3
|
+
import { maybeOpenUrl } from './_open-url.js';
|
|
4
|
+
const BROWSER_HANDOFF_URL_KEYS = [
|
|
5
|
+
'open_url',
|
|
6
|
+
'url',
|
|
7
|
+
'checkout_url',
|
|
8
|
+
'portal_url',
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes route-specific browser URLs into the CLI's stable handoff result.
|
|
12
|
+
* Billing routes expose Stripe-shaped checkout/portal fields, while OAuth and
|
|
13
|
+
* generic handoffs use open_url/url.
|
|
14
|
+
*/
|
|
15
|
+
export function extractOpenUrl(payload) {
|
|
16
|
+
for (const key of BROWSER_HANDOFF_URL_KEYS) {
|
|
17
|
+
const value = payload[key];
|
|
18
|
+
if (typeof value === 'string')
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
function validatedBrowserHandoffUrl(url) {
|
|
24
|
+
const trimmed = url.trim();
|
|
25
|
+
if (!trimmed) {
|
|
26
|
+
throw new CliHttpError('browser handoff response missing browser URL', EXIT_TRANSPORT);
|
|
27
|
+
}
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = new URL(trimmed);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
throw new CliHttpError('browser handoff response included an invalid browser URL', EXIT_TRANSPORT);
|
|
34
|
+
}
|
|
35
|
+
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
|
|
36
|
+
throw new CliHttpError('browser handoff response included a non-HTTP browser URL', EXIT_TRANSPORT);
|
|
37
|
+
}
|
|
38
|
+
return trimmed;
|
|
39
|
+
}
|
|
40
|
+
export async function buildBrowserHandoffResult({ command, url, globals, stderr, nextAction, }) {
|
|
41
|
+
const handoffUrl = validatedBrowserHandoffUrl(url);
|
|
42
|
+
const opened = await maybeOpenUrl(handoffUrl, globals, stderr);
|
|
43
|
+
return {
|
|
44
|
+
status: 'browser_flow_required',
|
|
45
|
+
command,
|
|
46
|
+
url: handoffUrl,
|
|
47
|
+
opened,
|
|
48
|
+
next_action: nextAction,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=_browser-handoff.js.map
|
|
@@ -0,0 +1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yB,CAAC,EAC9C,OAAO,EACP,GAAG,EACH,OAAO,EACP,MAAM,EACN,UAAU,GAOX;IACC,MAAM,UAAU,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,OAAO;QACL,MAAM,EAAE,uBAAuB;QAC/B,OAAO;QACP,GAAG,EAAE,UAAU;QACf,MAAM;QACN,WAAW,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CliGlobals } from '../grammar/globals.js';
|
|
2
|
-
export declare function maybeOpenUrl(url: string | undefined, globals: CliGlobals | undefined, stderr?: (chunk: string) => void): Promise<
|
|
2
|
+
export declare function maybeOpenUrl(url: string | undefined, globals: CliGlobals | undefined, stderr?: (chunk: string) => void): Promise<boolean>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export async function maybeOpenUrl(url, globals, stderr) {
|
|
2
2
|
if (!url || !globals?.open)
|
|
3
|
-
return;
|
|
3
|
+
return false;
|
|
4
4
|
if (!process.stdout.isTTY)
|
|
5
|
-
return;
|
|
5
|
+
return false;
|
|
6
6
|
try {
|
|
7
7
|
const mod = (await import('open'));
|
|
8
8
|
let open;
|
|
@@ -12,8 +12,10 @@ export async function maybeOpenUrl(url, globals, stderr) {
|
|
|
12
12
|
else if (mod && typeof mod.default === 'function') {
|
|
13
13
|
open = mod.default;
|
|
14
14
|
}
|
|
15
|
-
if (open)
|
|
15
|
+
if (open) {
|
|
16
16
|
await open(url);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
catch {
|
|
19
21
|
const msg = '--open skipped: install the `open` package to enable browser launch\n';
|
|
@@ -22,5 +24,6 @@ export async function maybeOpenUrl(url, globals, stderr) {
|
|
|
22
24
|
else
|
|
23
25
|
process.stderr.write(msg);
|
|
24
26
|
}
|
|
27
|
+
return false;
|
|
25
28
|
}
|
|
26
29
|
//# sourceMappingURL=_open-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_open-url.js","sourceRoot":"","sources":["../../src/commands/_open-url.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAuB,EACvB,OAA+B,EAC/B,MAAgC;IAEhC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI;QAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"_open-url.js","sourceRoot":"","sources":["../../src/commands/_open-url.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAuB,EACvB,OAA+B,EAC/B,MAAgC;IAEhC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,MAAgB,CAAC,CAAY,CAAC;QACxD,IAAI,IAAwB,CAAC;QAC7B,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YAC9B,IAAI,GAAG,GAAa,CAAC;QACvB,CAAC;aAAM,IAAI,GAAG,IAAI,OAAQ,GAA6B,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAC/E,IAAI,GAAI,GAA2B,CAAC,OAAO,CAAC;QAC9C,CAAC;QACD,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,GAAG,uEAAuE,CAAC;QACpF,IAAI,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;YACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ResolveSecretParamOptions {
|
|
2
|
+
readonly valueKey: string;
|
|
3
|
+
readonly envKey: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveSecretParam(params: Record<string, string | boolean>, options: ResolveSecretParamOptions): string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CliUsageError } from '../errors.js';
|
|
2
|
+
import { optionalString } from './utils.js';
|
|
3
|
+
export function resolveSecretParam(params, options) {
|
|
4
|
+
const directValue = optionalString(params, options.valueKey);
|
|
5
|
+
if (directValue !== undefined) {
|
|
6
|
+
return directValue;
|
|
7
|
+
}
|
|
8
|
+
const envName = optionalString(params, options.envKey);
|
|
9
|
+
if (envName !== undefined) {
|
|
10
|
+
const envValue = process.env[envName]?.trim();
|
|
11
|
+
if (envValue) {
|
|
12
|
+
return envValue;
|
|
13
|
+
}
|
|
14
|
+
throw new CliUsageError(`environment variable ${envName} is not set for --${options.envKey}`);
|
|
15
|
+
}
|
|
16
|
+
throw new CliUsageError(`missing required parameter: ${options.valueKey} or ${options.envKey} (${options.label})`);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=_secret-param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_secret-param.js","sourceRoot":"","sources":["../../src/commands/_secret-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C,MAAM,UAAU,kBAAkB,CAChC,MAAwC,EACxC,OAAkC;IAElC,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,aAAa,CACrB,wBAAwB,OAAO,qBAAqB,OAAO,CAAC,MAAM,EAAE,CACrE,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,aAAa,CACrB,+BAA+B,OAAO,CAAC,QAAQ,OAAO,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,KAAK,GAAG,CAC1F,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CliUsageError } from '../errors.js';
|
|
2
|
+
import { rejectApiKeyAuthMode } from './auth-mode.js';
|
|
2
3
|
import { requiredString } from './utils.js';
|
|
3
4
|
export const accountDetachCommand = async (context) => {
|
|
5
|
+
rejectApiKeyAuthMode(context, 'account:detach', 'session-auth-only');
|
|
4
6
|
const aliasUserId = requiredString(context.params, 'alias_user_id');
|
|
5
7
|
const confirm = requiredString(context.params, 'confirm');
|
|
6
8
|
if (confirm !== 'DETACH') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-detach.js","sourceRoot":"","sources":["../../src/commands/account-detach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IACpE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1D,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,aAAa,CAAC,6CAA6C,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB,EAAE;QAC1D,IAAI,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"account-detach.js","sourceRoot":"","sources":["../../src/commands/account-detach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IACpE,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1D,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,aAAa,CAAC,6CAA6C,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB,EAAE;QAC1D,IAAI,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { rejectApiKeyAuthMode } from './auth-mode.js';
|
|
1
2
|
import { requiredString } from './utils.js';
|
|
2
3
|
export const accountEmailsAddCommand = async (context) => {
|
|
4
|
+
rejectApiKeyAuthMode(context, 'account:emails:add', 'session-auth-only');
|
|
3
5
|
const email = requiredString(context.params, 'email');
|
|
4
6
|
return context.requestJson('POST', '/auth/accounts/emails', { body: { email } });
|
|
5
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-emails-add.js","sourceRoot":"","sources":["../../src/commands/account-emails-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,uBAAuB,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IACvE,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"account-emails-add.js","sourceRoot":"","sources":["../../src/commands/account-emails-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,uBAAuB,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IACvE,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { rejectApiKeyAuthMode } from './auth-mode.js';
|
|
1
2
|
import { requiredString } from './utils.js';
|
|
2
3
|
export const accountEmailsRemoveCommand = async (context) => {
|
|
4
|
+
rejectApiKeyAuthMode(context, 'account:emails:remove', 'session-auth-only');
|
|
3
5
|
const email = requiredString(context.params, 'email');
|
|
4
6
|
return context.requestJson('DELETE', `/auth/accounts/emails/${encodeURIComponent(email)}`);
|
|
5
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-emails-remove.js","sourceRoot":"","sources":["../../src/commands/account-emails-remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1E,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,yBAAyB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"account-emails-remove.js","sourceRoot":"","sources":["../../src/commands/account-emails-remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1E,oBAAoB,CAAC,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,yBAAyB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC"}
|