@mcpjam/cli 3.21.0 → 3.23.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/index.js +1062 -83
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { randomUUID } from 'crypto';
|
|
|
9
9
|
import { spawn } from 'child_process';
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
11
|
import os, { homedir } from 'os';
|
|
12
|
-
import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatboxesOperation, getChatboxOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation } from '@mcpjam/sdk/platform';
|
|
12
|
+
import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatboxesOperation, getChatboxOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listOrganizationsOperation, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, getCapabilitiesOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getJourneyOperation, createJourneyOperation, updateJourneyOperation, archiveJourneyOperation, generateJourneysOperation, getSwarmOverviewOperation, getJourneyRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getWaveInsightsOperation, requestWaveInsightsOperation, cancelWaveInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, getUserTestingScenarioOperation, listUserTestingSessionsOperation, getUserTestingSessionOperation, getUserTestingMetricsOperation, getUserTestingUsageOperation, listUserTestingFindingsOperation, getUserTestingSignalsOperation, getUserTestingInsightsOperation, requestUserTestingInsightsOperation, cancelUserTestingInsightsOperation, dismissUserTestingFindingOperation, undismissUserTestingFindingOperation, updateUserTestingScenarioOperation, setUserTestingGuestExecutionOperation, rotateUserTestingLinkOperation, upsertUserTestingMemberOperation, removeUserTestingMemberOperation, rebindUserTestingScenarioOperation } from '@mcpjam/sdk/platform';
|
|
13
13
|
import { buildHostProfilesFromCatalog, buildMarketHostProfiles, scanWidgetUsage, evaluateMarketHosts, fetchHostCompatCatalog } from '@mcpjam/sdk/host-compat';
|
|
14
14
|
import { HOST_TEMPLATES as HOST_TEMPLATES$1, HOST_TEMPLATE_IDS, seedHostTemplate } from '@mcpjam/sdk/host-config/templates';
|
|
15
15
|
import { applyVisibilityPolicyAndCountSignals, isAppOnlyTool, extractHostExecutionPolicy, hostConnectionProfile } from '@mcpjam/sdk/host-config/internal';
|
|
@@ -25,7 +25,7 @@ import { WebSocket } from 'ws';
|
|
|
25
25
|
|
|
26
26
|
// package.json
|
|
27
27
|
var package_default = {
|
|
28
|
-
version: "3.
|
|
28
|
+
version: "3.23.0"};
|
|
29
29
|
function conformanceExitCode(result) {
|
|
30
30
|
if (result.outcome === "incomplete") return 3;
|
|
31
31
|
if (result.outcome === "failed") return 1;
|
|
@@ -5105,6 +5105,7 @@ function registerJourneysCommands(program) {
|
|
|
5105
5105
|
writeResult(result, globalOptions.format);
|
|
5106
5106
|
}
|
|
5107
5107
|
);
|
|
5108
|
+
return journeys;
|
|
5108
5109
|
}
|
|
5109
5110
|
function addPlatformOptions5(command) {
|
|
5110
5111
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
@@ -5142,21 +5143,43 @@ function registerScenariosCommands(program) {
|
|
|
5142
5143
|
const scenarios = program.command("scenarios").description(
|
|
5143
5144
|
"Publish project environments for user testing, and take them down again"
|
|
5144
5145
|
);
|
|
5146
|
+
const SCENARIO_MODES = [
|
|
5147
|
+
"project_members",
|
|
5148
|
+
"invited_only",
|
|
5149
|
+
"anyone_with_link"
|
|
5150
|
+
];
|
|
5145
5151
|
addPlatformOptions5(
|
|
5146
5152
|
scenarios.command("publish").description(
|
|
5147
|
-
"Publish an environment as a scenario and print its share link. Idempotent \u2014 re-publishing returns the existing scenario, with created: false."
|
|
5153
|
+
"Publish an environment as a scenario and print its share link. Idempotent \u2014 re-publishing returns the existing scenario, with created: false. --name, --description and --mode apply at CREATE TIME, in the same call; on a re-publish they are ignored and the result says overridesIgnored: true (use `mcpjam user-testing update` to change an existing scenario)."
|
|
5148
5154
|
).requiredOption("--environment <id>", "Project environment ID").option(
|
|
5149
5155
|
"--project <id-or-name>",
|
|
5150
5156
|
"Project name or ID (defaults to the most recently updated project)"
|
|
5157
|
+
).option("--name <name>", "Scenario name (create time only)").option("--description <text>", "Scenario description (create time only)").option(
|
|
5158
|
+
"--mode <mode>",
|
|
5159
|
+
"Who may open the share link (create time only): project_members | invited_only | anyone_with_link"
|
|
5151
5160
|
)
|
|
5152
5161
|
).action(
|
|
5153
5162
|
async (options, command) => {
|
|
5154
5163
|
const globalOptions = getGlobalOptions(command);
|
|
5164
|
+
const mode = options.mode;
|
|
5165
|
+
if (mode !== void 0 && !SCENARIO_MODES.includes(mode)) {
|
|
5166
|
+
command.error(
|
|
5167
|
+
`error: option '--mode <mode>' must be one of ${SCENARIO_MODES.join(
|
|
5168
|
+
", "
|
|
5169
|
+
)}`
|
|
5170
|
+
);
|
|
5171
|
+
}
|
|
5155
5172
|
const result = await runPlatformCommand5(
|
|
5156
5173
|
options,
|
|
5157
5174
|
globalOptions.timeout,
|
|
5158
5175
|
({ client, signal }) => publishScenarioOperation.execute(
|
|
5159
|
-
{
|
|
5176
|
+
{
|
|
5177
|
+
project: options.project,
|
|
5178
|
+
environment: options.environment,
|
|
5179
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5180
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
5181
|
+
...mode !== void 0 ? { mode } : {}
|
|
5182
|
+
},
|
|
5160
5183
|
{ client, signal }
|
|
5161
5184
|
)
|
|
5162
5185
|
);
|
|
@@ -5182,6 +5205,876 @@ function registerScenariosCommands(program) {
|
|
|
5182
5205
|
}
|
|
5183
5206
|
);
|
|
5184
5207
|
}
|
|
5208
|
+
function addPlatformOptions6(command) {
|
|
5209
|
+
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
5210
|
+
"--api-url <url>",
|
|
5211
|
+
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
5212
|
+
);
|
|
5213
|
+
}
|
|
5214
|
+
async function runPlatformCommand6(options, timeoutMs, execute) {
|
|
5215
|
+
const controller = new AbortController();
|
|
5216
|
+
const timeoutHandle = setTimeout(() => {
|
|
5217
|
+
controller.abort(
|
|
5218
|
+
new PlatformApiError(
|
|
5219
|
+
`Request timed out after ${timeoutMs}ms`,
|
|
5220
|
+
"TIMEOUT",
|
|
5221
|
+
{
|
|
5222
|
+
status: 0
|
|
5223
|
+
}
|
|
5224
|
+
)
|
|
5225
|
+
);
|
|
5226
|
+
}, timeoutMs);
|
|
5227
|
+
timeoutHandle.unref?.();
|
|
5228
|
+
try {
|
|
5229
|
+
const { client } = buildPlatformClient({ ...options, timeoutMs });
|
|
5230
|
+
return await execute({ client, signal: controller.signal });
|
|
5231
|
+
} catch (error) {
|
|
5232
|
+
if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
|
|
5233
|
+
throw toCliError(controller.signal.reason);
|
|
5234
|
+
}
|
|
5235
|
+
throw toCliError(error);
|
|
5236
|
+
} finally {
|
|
5237
|
+
clearTimeout(timeoutHandle);
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
function bindOperation(command, operation, buildInput) {
|
|
5241
|
+
addPlatformOptions6(command).action(
|
|
5242
|
+
async (options, invoked) => {
|
|
5243
|
+
const globalOptions = getGlobalOptions(invoked);
|
|
5244
|
+
const result = await runPlatformCommand6(
|
|
5245
|
+
options,
|
|
5246
|
+
globalOptions.timeout,
|
|
5247
|
+
({ client, signal }) => operation.execute(buildInput(options), { client, signal })
|
|
5248
|
+
);
|
|
5249
|
+
writeResult(result, globalOptions.format);
|
|
5250
|
+
}
|
|
5251
|
+
);
|
|
5252
|
+
}
|
|
5253
|
+
function addProjectOption(command) {
|
|
5254
|
+
return command.option(
|
|
5255
|
+
"--project <id-or-name>",
|
|
5256
|
+
"Project name or ID (defaults to the most recently updated project)"
|
|
5257
|
+
);
|
|
5258
|
+
}
|
|
5259
|
+
function parseIntegerOption(value, flag, bounds) {
|
|
5260
|
+
if (value === void 0) return void 0;
|
|
5261
|
+
const trimmed = value.trim();
|
|
5262
|
+
const parsed = trimmed === "" ? Number.NaN : Number(trimmed);
|
|
5263
|
+
if (!Number.isInteger(parsed)) {
|
|
5264
|
+
throw usageError(`${flag} must be a whole number`);
|
|
5265
|
+
}
|
|
5266
|
+
if (bounds?.min !== void 0 && parsed < bounds.min) {
|
|
5267
|
+
throw usageError(`${flag} must be at least ${bounds.min}`);
|
|
5268
|
+
}
|
|
5269
|
+
if (bounds?.max !== void 0 && parsed > bounds.max) {
|
|
5270
|
+
throw usageError(`${flag} must be at most ${bounds.max}`);
|
|
5271
|
+
}
|
|
5272
|
+
return parsed;
|
|
5273
|
+
}
|
|
5274
|
+
function parseRequiredIntegerOption(value, flag, bounds) {
|
|
5275
|
+
return parseIntegerOption(value, flag, bounds);
|
|
5276
|
+
}
|
|
5277
|
+
function requireExactlyOne(flags) {
|
|
5278
|
+
const supplied = Object.entries(flags).filter(
|
|
5279
|
+
([, value]) => value !== void 0 && value !== ""
|
|
5280
|
+
);
|
|
5281
|
+
if (supplied.length === 1) return;
|
|
5282
|
+
const names = Object.keys(flags).join(" or ");
|
|
5283
|
+
throw usageError(
|
|
5284
|
+
supplied.length === 0 ? `Provide ${names}.` : `Provide only one of ${names}.`
|
|
5285
|
+
);
|
|
5286
|
+
}
|
|
5287
|
+
function requireTogether(first, second) {
|
|
5288
|
+
if (first.value === void 0 === (second.value === void 0)) return;
|
|
5289
|
+
throw usageError(
|
|
5290
|
+
`${first.flag} and ${second.flag} must be given together \u2014 they are one execution config upstream.`
|
|
5291
|
+
);
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
// src/commands/swarms.ts
|
|
5295
|
+
var SESSIONS_BOUNDS = { min: 1, max: 100 };
|
|
5296
|
+
var TURNS_BOUNDS = { min: 1, max: 200 };
|
|
5297
|
+
var JOURNEY_COUNT_BOUNDS = { min: 1, max: 5 };
|
|
5298
|
+
var PERSONA_COUNT_BOUNDS = { min: 1, max: 12 };
|
|
5299
|
+
function groundingArgs(options) {
|
|
5300
|
+
requireExactlyOne({
|
|
5301
|
+
"--environment": options.environment,
|
|
5302
|
+
"--server-attachment": options.serverAttachment
|
|
5303
|
+
});
|
|
5304
|
+
const journeyCount = parseIntegerOption(
|
|
5305
|
+
options.journeyCount,
|
|
5306
|
+
"--journey-count",
|
|
5307
|
+
JOURNEY_COUNT_BOUNDS
|
|
5308
|
+
);
|
|
5309
|
+
return {
|
|
5310
|
+
...options.environment ? { environmentId: options.environment } : {},
|
|
5311
|
+
...options.serverAttachment ? { serverAttachmentId: options.serverAttachment } : {},
|
|
5312
|
+
...options.description ? { description: options.description } : {},
|
|
5313
|
+
...journeyCount !== void 0 ? { journeyCount } : {}
|
|
5314
|
+
};
|
|
5315
|
+
}
|
|
5316
|
+
function addConfigOptions(command, required) {
|
|
5317
|
+
const sessions = "--sessions-per-target <n>";
|
|
5318
|
+
const turns = "--max-turns <n>";
|
|
5319
|
+
const sessionsHelp = "Sessions run against EACH target. Total sessions = targets x this, and the total is what spends.";
|
|
5320
|
+
const turnsHelp = "Cap on assistant turns per session.";
|
|
5321
|
+
return required ? command.requiredOption(sessions, sessionsHelp).requiredOption(turns, turnsHelp) : command.option(sessions, sessionsHelp).option(turns, turnsHelp);
|
|
5322
|
+
}
|
|
5323
|
+
function addGroundingOptions(command) {
|
|
5324
|
+
return command.option(
|
|
5325
|
+
"--environment <id>",
|
|
5326
|
+
"Ground the drafts in this project environment. Use this one normally."
|
|
5327
|
+
).option(
|
|
5328
|
+
"--server-attachment <id>",
|
|
5329
|
+
"Legacy grounding source. Prefer --environment."
|
|
5330
|
+
).option("--description <text>", "Who the audience is, in your own words.").option("--journey-count <n>", "How many journeys to draft per persona.");
|
|
5331
|
+
}
|
|
5332
|
+
function registerSwarmAuthoringCommands(program, journeys) {
|
|
5333
|
+
bindOperation(
|
|
5334
|
+
addProjectOption(
|
|
5335
|
+
program.command("capabilities").description(
|
|
5336
|
+
"Show what you may do in a project: your role, which betas the organization has, your plan's limits, and a can-block of booleans. Ask this before scripting anything that authors, launches or publishes."
|
|
5337
|
+
)
|
|
5338
|
+
),
|
|
5339
|
+
getCapabilitiesOperation,
|
|
5340
|
+
(options) => ({ project: options.project })
|
|
5341
|
+
);
|
|
5342
|
+
const personas = program.command("personas").description(
|
|
5343
|
+
"The reusable synthetic characters Swarms journeys run as. A persona carries a name, a role and behavioural notes; the goal lives on each journey."
|
|
5344
|
+
);
|
|
5345
|
+
bindOperation(
|
|
5346
|
+
addProjectOption(
|
|
5347
|
+
personas.command("list").description("List the project's personas.")
|
|
5348
|
+
),
|
|
5349
|
+
listPersonasOperation,
|
|
5350
|
+
(options) => ({ project: options.project })
|
|
5351
|
+
);
|
|
5352
|
+
bindOperation(
|
|
5353
|
+
addProjectOption(
|
|
5354
|
+
personas.command("get").description("Show one persona in full, including its notes.").requiredOption("--persona <id>", "Persona ID")
|
|
5355
|
+
),
|
|
5356
|
+
getPersonaOperation,
|
|
5357
|
+
(options) => ({
|
|
5358
|
+
project: options.project,
|
|
5359
|
+
persona: options.persona
|
|
5360
|
+
})
|
|
5361
|
+
);
|
|
5362
|
+
bindOperation(
|
|
5363
|
+
addProjectOption(
|
|
5364
|
+
personas.command("create").description(
|
|
5365
|
+
"Create a persona. Pass --idempotency-key when scripting: the server replays it BEFORE uniquifying the slug, so a retry without one leaves a second near-identical persona rather than the one you already made."
|
|
5366
|
+
).requiredOption("--name <name>", "Display name").requiredOption(
|
|
5367
|
+
"--role <role>",
|
|
5368
|
+
"Who they are, in a few words \u2014 'enterprise procurement lead'"
|
|
5369
|
+
).option(
|
|
5370
|
+
"--notes <text>",
|
|
5371
|
+
"How they behave: what they know, what they will not tolerate, how they phrase things"
|
|
5372
|
+
).option("--idempotency-key <key>", "Retry key")
|
|
5373
|
+
),
|
|
5374
|
+
createPersonaOperation,
|
|
5375
|
+
(options) => ({
|
|
5376
|
+
project: options.project,
|
|
5377
|
+
name: options.name,
|
|
5378
|
+
role: options.role,
|
|
5379
|
+
...options.notes !== void 0 ? { notes: options.notes } : {},
|
|
5380
|
+
...options.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {}
|
|
5381
|
+
})
|
|
5382
|
+
);
|
|
5383
|
+
bindOperation(
|
|
5384
|
+
addProjectOption(
|
|
5385
|
+
personas.command("update").description(
|
|
5386
|
+
"Edit a persona. Finished runs keep the persona they ran as \u2014 editing does not rewrite history."
|
|
5387
|
+
).requiredOption("--persona <id>", "Persona ID").option("--name <name>").option("--role <role>").option("--notes <text>")
|
|
5388
|
+
),
|
|
5389
|
+
updatePersonaOperation,
|
|
5390
|
+
(options) => ({
|
|
5391
|
+
project: options.project,
|
|
5392
|
+
persona: options.persona,
|
|
5393
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5394
|
+
...options.role !== void 0 ? { role: options.role } : {},
|
|
5395
|
+
...options.notes !== void 0 ? { notes: options.notes } : {}
|
|
5396
|
+
})
|
|
5397
|
+
);
|
|
5398
|
+
bindOperation(
|
|
5399
|
+
addProjectOption(
|
|
5400
|
+
personas.command("delete").description(
|
|
5401
|
+
"Take a persona off the roster. SOFT: finished runs and sessions keep resolving it, so history stays readable, but it cannot be used for new journeys and a second delete answers not-found."
|
|
5402
|
+
).requiredOption("--persona <id>", "Persona ID")
|
|
5403
|
+
),
|
|
5404
|
+
deletePersonaOperation,
|
|
5405
|
+
(options) => ({
|
|
5406
|
+
project: options.project,
|
|
5407
|
+
persona: options.persona
|
|
5408
|
+
})
|
|
5409
|
+
);
|
|
5410
|
+
bindOperation(
|
|
5411
|
+
addGroundingOptions(
|
|
5412
|
+
addProjectOption(
|
|
5413
|
+
personas.command("generate").description(
|
|
5414
|
+
"Draft candidate personas with a model, grounded in what the project's servers do. SAVES NOTHING \u2014 pipe what you want into `personas create`. Spends."
|
|
5415
|
+
).option("--persona-count <n>", "Draft a slate of N personas.")
|
|
5416
|
+
)
|
|
5417
|
+
),
|
|
5418
|
+
generatePersonasOperation,
|
|
5419
|
+
(options) => {
|
|
5420
|
+
const personaCount = parseIntegerOption(
|
|
5421
|
+
options.personaCount,
|
|
5422
|
+
"--persona-count",
|
|
5423
|
+
PERSONA_COUNT_BOUNDS
|
|
5424
|
+
);
|
|
5425
|
+
return {
|
|
5426
|
+
project: options.project,
|
|
5427
|
+
...groundingArgs(options),
|
|
5428
|
+
...personaCount !== void 0 ? { personaCount } : {}
|
|
5429
|
+
};
|
|
5430
|
+
}
|
|
5431
|
+
);
|
|
5432
|
+
bindOperation(
|
|
5433
|
+
addProjectOption(
|
|
5434
|
+
journeys.command("get").description(
|
|
5435
|
+
"Show one journey in full. Read this before launching if you want to know what a run will cost: it produces targets x sessionsPerTarget conversations."
|
|
5436
|
+
).requiredOption("--journey <id>", "Journey ID")
|
|
5437
|
+
),
|
|
5438
|
+
getJourneyOperation,
|
|
5439
|
+
(options) => ({
|
|
5440
|
+
project: options.project,
|
|
5441
|
+
journey: options.journey
|
|
5442
|
+
})
|
|
5443
|
+
);
|
|
5444
|
+
bindOperation(
|
|
5445
|
+
addConfigOptions(
|
|
5446
|
+
addProjectOption(
|
|
5447
|
+
journeys.command("create").description(
|
|
5448
|
+
"Author a journey: a persona, a goal, and the environments to pursue it against. Creating does NOT run it \u2014 `journeys run` does, and that is the call that spends."
|
|
5449
|
+
).requiredOption(
|
|
5450
|
+
"--goal <text>",
|
|
5451
|
+
"What the persona is trying to accomplish"
|
|
5452
|
+
).requiredOption("--persona <id>", "Persona ID to run as").option("--name <name>").option("--swarm <id>", "Swarm container ID (authoring provenance)").option(
|
|
5453
|
+
"--environment <id>",
|
|
5454
|
+
"Environment to fan out across. Repeatable.",
|
|
5455
|
+
(value, previous = []) => [...previous, value]
|
|
5456
|
+
).option("--idempotency-key <key>", "Retry key")
|
|
5457
|
+
),
|
|
5458
|
+
true
|
|
5459
|
+
),
|
|
5460
|
+
createJourneyOperation,
|
|
5461
|
+
(options) => ({
|
|
5462
|
+
project: options.project,
|
|
5463
|
+
goal: options.goal,
|
|
5464
|
+
persona: options.persona,
|
|
5465
|
+
sessionsPerTarget: parseRequiredIntegerOption(
|
|
5466
|
+
options.sessionsPerTarget,
|
|
5467
|
+
"--sessions-per-target",
|
|
5468
|
+
SESSIONS_BOUNDS
|
|
5469
|
+
),
|
|
5470
|
+
maxTurns: parseRequiredIntegerOption(
|
|
5471
|
+
options.maxTurns,
|
|
5472
|
+
"--max-turns",
|
|
5473
|
+
TURNS_BOUNDS
|
|
5474
|
+
),
|
|
5475
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5476
|
+
...options.swarm !== void 0 ? { swarm: options.swarm } : {},
|
|
5477
|
+
...options.environment?.length ? { environmentIds: options.environment } : {},
|
|
5478
|
+
...options.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {}
|
|
5479
|
+
})
|
|
5480
|
+
);
|
|
5481
|
+
bindOperation(
|
|
5482
|
+
addConfigOptions(
|
|
5483
|
+
addProjectOption(
|
|
5484
|
+
journeys.command("update").description(
|
|
5485
|
+
"Edit a journey. --sessions-per-target and --max-turns must be given together (they are one config upstream). A run already in flight keeps the config it launched with."
|
|
5486
|
+
).requiredOption("--journey <id>", "Journey ID").option("--name <name>").option("--goal <text>").option(
|
|
5487
|
+
"--environment <id>",
|
|
5488
|
+
"Replace the fan-out with these. Repeatable.",
|
|
5489
|
+
(value, previous = []) => [...previous, value]
|
|
5490
|
+
).option(
|
|
5491
|
+
"--clear-environments",
|
|
5492
|
+
"Drop the fan-out and return the journey to its host targets."
|
|
5493
|
+
)
|
|
5494
|
+
),
|
|
5495
|
+
false
|
|
5496
|
+
),
|
|
5497
|
+
updateJourneyOperation,
|
|
5498
|
+
(options) => {
|
|
5499
|
+
if (options.clearEnvironments && options.environment?.length) {
|
|
5500
|
+
throw new Error(
|
|
5501
|
+
"--clear-environments and --environment cannot be used together"
|
|
5502
|
+
);
|
|
5503
|
+
}
|
|
5504
|
+
requireTogether(
|
|
5505
|
+
{ flag: "--sessions-per-target", value: options.sessionsPerTarget },
|
|
5506
|
+
{ flag: "--max-turns", value: options.maxTurns }
|
|
5507
|
+
);
|
|
5508
|
+
return {
|
|
5509
|
+
project: options.project,
|
|
5510
|
+
journey: options.journey,
|
|
5511
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5512
|
+
...options.goal !== void 0 ? { goal: options.goal } : {},
|
|
5513
|
+
...options.clearEnvironments ? { environmentIds: null } : options.environment?.length ? { environmentIds: options.environment } : {},
|
|
5514
|
+
...options.sessionsPerTarget !== void 0 ? {
|
|
5515
|
+
sessionsPerTarget: parseIntegerOption(
|
|
5516
|
+
options.sessionsPerTarget,
|
|
5517
|
+
"--sessions-per-target",
|
|
5518
|
+
SESSIONS_BOUNDS
|
|
5519
|
+
)
|
|
5520
|
+
} : {},
|
|
5521
|
+
...options.maxTurns !== void 0 ? {
|
|
5522
|
+
maxTurns: parseIntegerOption(
|
|
5523
|
+
options.maxTurns,
|
|
5524
|
+
"--max-turns",
|
|
5525
|
+
TURNS_BOUNDS
|
|
5526
|
+
)
|
|
5527
|
+
} : {}
|
|
5528
|
+
};
|
|
5529
|
+
}
|
|
5530
|
+
);
|
|
5531
|
+
bindOperation(
|
|
5532
|
+
addProjectOption(
|
|
5533
|
+
journeys.command("archive").description(
|
|
5534
|
+
"Take a journey off the roster. Its runs, sessions and scorecards stay readable \u2014 the evidence for past decisions is not deleted with the journey that produced it."
|
|
5535
|
+
).requiredOption("--journey <id>", "Journey ID")
|
|
5536
|
+
),
|
|
5537
|
+
archiveJourneyOperation,
|
|
5538
|
+
(options) => ({
|
|
5539
|
+
project: options.project,
|
|
5540
|
+
journey: options.journey
|
|
5541
|
+
})
|
|
5542
|
+
);
|
|
5543
|
+
bindOperation(
|
|
5544
|
+
addGroundingOptions(
|
|
5545
|
+
addProjectOption(
|
|
5546
|
+
journeys.command("generate").description(
|
|
5547
|
+
"Draft candidate journeys for a persona with a model. The persona is passed BY VALUE and does not have to exist yet, because the create flow drafts both before saving either. SAVES NOTHING; spends."
|
|
5548
|
+
).requiredOption("--persona-name <name>").requiredOption("--persona-role <role>").option("--persona-notes <text>")
|
|
5549
|
+
)
|
|
5550
|
+
),
|
|
5551
|
+
generateJourneysOperation,
|
|
5552
|
+
(options) => ({
|
|
5553
|
+
project: options.project,
|
|
5554
|
+
persona: {
|
|
5555
|
+
name: options.personaName,
|
|
5556
|
+
role: options.personaRole,
|
|
5557
|
+
...options.personaNotes !== void 0 ? { notes: options.personaNotes } : {}
|
|
5558
|
+
},
|
|
5559
|
+
...groundingArgs(options)
|
|
5560
|
+
})
|
|
5561
|
+
);
|
|
5562
|
+
bindOperation(
|
|
5563
|
+
addProjectOption(
|
|
5564
|
+
journeys.command("overview").description(
|
|
5565
|
+
"The project's recent runs with their rubric findings and goal-completion trend \u2014 the roll-up the Swarms page shows. Rates are over GRADED sessions; passRate null means nothing has been graded, not that everything failed."
|
|
5566
|
+
)
|
|
5567
|
+
),
|
|
5568
|
+
getSwarmOverviewOperation,
|
|
5569
|
+
(options) => ({ project: options.project })
|
|
5570
|
+
);
|
|
5571
|
+
bindOperation(
|
|
5572
|
+
addProjectOption(
|
|
5573
|
+
journeys.command("scorecard").description(
|
|
5574
|
+
"Per-criterion pass/fail counts for one run. Deterministic \u2014 no model involved \u2014 so this is the first thing to read when explaining a failure. failedGradingCount is grading that BROKE; do not add it to failCount."
|
|
5575
|
+
).requiredOption("--run <id>", "Journey run ID")
|
|
5576
|
+
),
|
|
5577
|
+
getJourneyRunScorecardOperation,
|
|
5578
|
+
(options) => ({
|
|
5579
|
+
project: options.project,
|
|
5580
|
+
run: options.run
|
|
5581
|
+
})
|
|
5582
|
+
);
|
|
5583
|
+
bindOperation(
|
|
5584
|
+
addProjectOption(
|
|
5585
|
+
journeys.command("findings").description(
|
|
5586
|
+
"Criteria that keep failing across waves, with how long each has been failing."
|
|
5587
|
+
)
|
|
5588
|
+
),
|
|
5589
|
+
listSwarmFindingsOperation,
|
|
5590
|
+
(options) => ({ project: options.project })
|
|
5591
|
+
);
|
|
5592
|
+
bindOperation(
|
|
5593
|
+
addProjectOption(
|
|
5594
|
+
journeys.command("dismiss-finding").description(
|
|
5595
|
+
"Mark a finding as not worth acting on. Its lifecycle keeps updating underneath, so undismissing later shows honest current state."
|
|
5596
|
+
).requiredOption("--finding <id>", "Finding ID")
|
|
5597
|
+
),
|
|
5598
|
+
dismissSwarmFindingOperation,
|
|
5599
|
+
(options) => ({
|
|
5600
|
+
project: options.project,
|
|
5601
|
+
finding: options.finding
|
|
5602
|
+
})
|
|
5603
|
+
);
|
|
5604
|
+
bindOperation(
|
|
5605
|
+
addProjectOption(
|
|
5606
|
+
journeys.command("undismiss-finding").description("Bring a dismissed finding back into the active list.").requiredOption("--finding <id>", "Finding ID")
|
|
5607
|
+
),
|
|
5608
|
+
undismissSwarmFindingOperation,
|
|
5609
|
+
(options) => ({
|
|
5610
|
+
project: options.project,
|
|
5611
|
+
finding: options.finding
|
|
5612
|
+
})
|
|
5613
|
+
);
|
|
5614
|
+
bindOperation(
|
|
5615
|
+
addProjectOption(
|
|
5616
|
+
journeys.command("insights").description(
|
|
5617
|
+
"The model's analysis of a whole wave, if one has been requested. Not-found means nobody asked for it, which is different from asked-and-still-working."
|
|
5618
|
+
).requiredOption("--wave <id>", "Wave ID (the waveId on a run)")
|
|
5619
|
+
),
|
|
5620
|
+
getWaveInsightsOperation,
|
|
5621
|
+
(options) => ({
|
|
5622
|
+
project: options.project,
|
|
5623
|
+
wave: options.wave
|
|
5624
|
+
})
|
|
5625
|
+
);
|
|
5626
|
+
bindOperation(
|
|
5627
|
+
addProjectOption(
|
|
5628
|
+
journeys.command("request-insights").description(
|
|
5629
|
+
"Ask a model to analyze a whole wave. Returns immediately as pending; poll `journeys insights`. SPENDS against a daily budget shared with user-testing insights. Read the scorecards first \u2014 they are free and usually explain the failure."
|
|
5630
|
+
).requiredOption("--wave <id>", "Wave ID").option(
|
|
5631
|
+
"--force",
|
|
5632
|
+
"Regenerate over a wave that already has insights. Spends again."
|
|
5633
|
+
)
|
|
5634
|
+
),
|
|
5635
|
+
requestWaveInsightsOperation,
|
|
5636
|
+
(options) => ({
|
|
5637
|
+
project: options.project,
|
|
5638
|
+
wave: options.wave,
|
|
5639
|
+
...options.force ? { force: true } : {}
|
|
5640
|
+
})
|
|
5641
|
+
);
|
|
5642
|
+
bindOperation(
|
|
5643
|
+
addProjectOption(
|
|
5644
|
+
journeys.command("cancel-insights").description(
|
|
5645
|
+
"Stop an in-flight insights generation. The recovery path for a wave stuck pending \u2014 without it the only way forward is --force, which spends again."
|
|
5646
|
+
).requiredOption("--wave <id>", "Wave ID")
|
|
5647
|
+
),
|
|
5648
|
+
cancelWaveInsightsOperation,
|
|
5649
|
+
(options) => ({
|
|
5650
|
+
project: options.project,
|
|
5651
|
+
wave: options.wave
|
|
5652
|
+
})
|
|
5653
|
+
);
|
|
5654
|
+
const swarms = program.command("swarms").description(
|
|
5655
|
+
"Swarm containers group journeys authored together and hold their shared execution config. A journey does not need one, but a project authored through the app will have them."
|
|
5656
|
+
);
|
|
5657
|
+
bindOperation(
|
|
5658
|
+
addProjectOption(
|
|
5659
|
+
swarms.command("list").description("List the project's swarm containers.")
|
|
5660
|
+
),
|
|
5661
|
+
listSwarmsOperation,
|
|
5662
|
+
(options) => ({ project: options.project })
|
|
5663
|
+
);
|
|
5664
|
+
bindOperation(
|
|
5665
|
+
addProjectOption(
|
|
5666
|
+
swarms.command("get").description("Show one swarm container.").requiredOption("--swarm <id>", "Swarm container ID")
|
|
5667
|
+
),
|
|
5668
|
+
getSwarmOperation,
|
|
5669
|
+
(options) => ({
|
|
5670
|
+
project: options.project,
|
|
5671
|
+
swarm: options.swarm
|
|
5672
|
+
})
|
|
5673
|
+
);
|
|
5674
|
+
bindOperation(
|
|
5675
|
+
addConfigOptions(
|
|
5676
|
+
addProjectOption(
|
|
5677
|
+
swarms.command("create").description(
|
|
5678
|
+
"Create a container to author journeys under. Runs nothing."
|
|
5679
|
+
).requiredOption("--name <name>").option("--description <text>").option(
|
|
5680
|
+
"--environment <id>",
|
|
5681
|
+
"Default fan-out for journeys authored here. Repeatable.",
|
|
5682
|
+
(value, previous = []) => [...previous, value]
|
|
5683
|
+
).option("--idempotency-key <key>", "Retry key")
|
|
5684
|
+
),
|
|
5685
|
+
true
|
|
5686
|
+
),
|
|
5687
|
+
createSwarmOperation,
|
|
5688
|
+
(options) => ({
|
|
5689
|
+
project: options.project,
|
|
5690
|
+
name: options.name,
|
|
5691
|
+
sessionsPerTarget: parseRequiredIntegerOption(
|
|
5692
|
+
options.sessionsPerTarget,
|
|
5693
|
+
"--sessions-per-target",
|
|
5694
|
+
SESSIONS_BOUNDS
|
|
5695
|
+
),
|
|
5696
|
+
maxTurns: parseRequiredIntegerOption(
|
|
5697
|
+
options.maxTurns,
|
|
5698
|
+
"--max-turns",
|
|
5699
|
+
TURNS_BOUNDS
|
|
5700
|
+
),
|
|
5701
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
5702
|
+
...options.environment?.length ? { environmentIds: options.environment } : {},
|
|
5703
|
+
...options.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {}
|
|
5704
|
+
})
|
|
5705
|
+
);
|
|
5706
|
+
bindOperation(
|
|
5707
|
+
addConfigOptions(
|
|
5708
|
+
addProjectOption(
|
|
5709
|
+
swarms.command("update").description(
|
|
5710
|
+
"Edit a swarm container. --sessions-per-target and --max-turns must be given together."
|
|
5711
|
+
).requiredOption("--swarm <id>", "Swarm container ID").option("--name <name>").option("--description <text>").option(
|
|
5712
|
+
"--environment <id>",
|
|
5713
|
+
"Replace the default fan-out. Repeatable.",
|
|
5714
|
+
(value, previous = []) => [...previous, value]
|
|
5715
|
+
)
|
|
5716
|
+
),
|
|
5717
|
+
false
|
|
5718
|
+
),
|
|
5719
|
+
updateSwarmOperation,
|
|
5720
|
+
(options) => ({
|
|
5721
|
+
project: options.project,
|
|
5722
|
+
swarm: options.swarm,
|
|
5723
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5724
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
5725
|
+
...options.environment?.length ? { environmentIds: options.environment } : {},
|
|
5726
|
+
...options.sessionsPerTarget !== void 0 ? {
|
|
5727
|
+
sessionsPerTarget: parseIntegerOption(
|
|
5728
|
+
options.sessionsPerTarget,
|
|
5729
|
+
"--sessions-per-target"
|
|
5730
|
+
)
|
|
5731
|
+
} : {},
|
|
5732
|
+
...options.maxTurns !== void 0 ? { maxTurns: parseIntegerOption(options.maxTurns, "--max-turns") } : {}
|
|
5733
|
+
})
|
|
5734
|
+
);
|
|
5735
|
+
bindOperation(
|
|
5736
|
+
addProjectOption(
|
|
5737
|
+
swarms.command("archive").description(
|
|
5738
|
+
"Take a container off the roster. Journeys authored under it keep working \u2014 the reference is authoring provenance, not ownership."
|
|
5739
|
+
).requiredOption("--swarm <id>", "Swarm container ID")
|
|
5740
|
+
),
|
|
5741
|
+
archiveSwarmOperation,
|
|
5742
|
+
(options) => ({
|
|
5743
|
+
project: options.project,
|
|
5744
|
+
swarm: options.swarm
|
|
5745
|
+
})
|
|
5746
|
+
);
|
|
5747
|
+
}
|
|
5748
|
+
function scenarioCommand(group, name, description) {
|
|
5749
|
+
return addProjectOption(
|
|
5750
|
+
group.command(name).description(description).requiredOption("--scenario <id>", "Scenario ID")
|
|
5751
|
+
);
|
|
5752
|
+
}
|
|
5753
|
+
function addPageOptions2(command) {
|
|
5754
|
+
return command.option("--cursor <cursor>", "Page cursor from a previous response").option("--limit <n>", "Page size");
|
|
5755
|
+
}
|
|
5756
|
+
function pageArgs2(options) {
|
|
5757
|
+
const limit = parseIntegerOption(options.limit, "--limit");
|
|
5758
|
+
return {
|
|
5759
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
5760
|
+
...limit !== void 0 ? { limit } : {}
|
|
5761
|
+
};
|
|
5762
|
+
}
|
|
5763
|
+
function registerUserTestingCommands(program) {
|
|
5764
|
+
const group = program.command("user-testing").description(
|
|
5765
|
+
"Read what a published scenario produced, and control who can reach it"
|
|
5766
|
+
);
|
|
5767
|
+
bindOperation(
|
|
5768
|
+
scenarioCommand(
|
|
5769
|
+
group,
|
|
5770
|
+
"get",
|
|
5771
|
+
"Scenario detail plus its actionable-insights envelope: findings aggregated over the latest analyzed window, with exemplar evidence. Only actionTarget mcp_server with actionability ready authorizes proposing a server change."
|
|
5772
|
+
),
|
|
5773
|
+
getUserTestingScenarioOperation,
|
|
5774
|
+
(options) => ({
|
|
5775
|
+
project: options.project,
|
|
5776
|
+
scenario: options.scenario
|
|
5777
|
+
})
|
|
5778
|
+
);
|
|
5779
|
+
bindOperation(
|
|
5780
|
+
addPageOptions2(
|
|
5781
|
+
scenarioCommand(
|
|
5782
|
+
group,
|
|
5783
|
+
"sessions",
|
|
5784
|
+
"List the sessions real visitors had with a scenario: counts, feedback, device and segment, with a first-message preview. Summaries only \u2014 use `session` for a transcript."
|
|
5785
|
+
)
|
|
5786
|
+
),
|
|
5787
|
+
listUserTestingSessionsOperation,
|
|
5788
|
+
(options) => ({
|
|
5789
|
+
project: options.project,
|
|
5790
|
+
scenario: options.scenario,
|
|
5791
|
+
...pageArgs2(options)
|
|
5792
|
+
})
|
|
5793
|
+
);
|
|
5794
|
+
bindOperation(
|
|
5795
|
+
addPageOptions2(
|
|
5796
|
+
scenarioCommand(
|
|
5797
|
+
group,
|
|
5798
|
+
"session",
|
|
5799
|
+
"Read one session's conversation, paged. These are real people talking to your product; prefer `metrics` or `findings` when you want the pattern rather than the words."
|
|
5800
|
+
).requiredOption("--session <id>", "Session ID")
|
|
5801
|
+
),
|
|
5802
|
+
getUserTestingSessionOperation,
|
|
5803
|
+
(options) => ({
|
|
5804
|
+
project: options.project,
|
|
5805
|
+
scenario: options.scenario,
|
|
5806
|
+
session: options.session,
|
|
5807
|
+
...pageArgs2(options)
|
|
5808
|
+
})
|
|
5809
|
+
);
|
|
5810
|
+
bindOperation(
|
|
5811
|
+
scenarioCommand(
|
|
5812
|
+
group,
|
|
5813
|
+
"metrics",
|
|
5814
|
+
"Aggregate metrics across a scenario's sessions."
|
|
5815
|
+
).option("--population <name>", "Restrict to a session population"),
|
|
5816
|
+
getUserTestingMetricsOperation,
|
|
5817
|
+
(options) => ({
|
|
5818
|
+
project: options.project,
|
|
5819
|
+
scenario: options.scenario,
|
|
5820
|
+
...options.population ? { population: options.population } : {}
|
|
5821
|
+
})
|
|
5822
|
+
);
|
|
5823
|
+
bindOperation(
|
|
5824
|
+
scenarioCommand(
|
|
5825
|
+
group,
|
|
5826
|
+
"usage",
|
|
5827
|
+
"Usage rates by visitor and device. Check `scan.truncated` before quoting any rate: true means it was computed over the most recent sessions, not all of them."
|
|
5828
|
+
),
|
|
5829
|
+
getUserTestingUsageOperation,
|
|
5830
|
+
(options) => ({
|
|
5831
|
+
project: options.project,
|
|
5832
|
+
scenario: options.scenario
|
|
5833
|
+
})
|
|
5834
|
+
);
|
|
5835
|
+
bindOperation(
|
|
5836
|
+
scenarioCommand(
|
|
5837
|
+
group,
|
|
5838
|
+
"findings",
|
|
5839
|
+
"Problems detected across a scenario's sessions, tracked over time."
|
|
5840
|
+
),
|
|
5841
|
+
listUserTestingFindingsOperation,
|
|
5842
|
+
(options) => ({
|
|
5843
|
+
project: options.project,
|
|
5844
|
+
scenario: options.scenario
|
|
5845
|
+
})
|
|
5846
|
+
);
|
|
5847
|
+
bindOperation(
|
|
5848
|
+
scenarioCommand(
|
|
5849
|
+
group,
|
|
5850
|
+
"signals",
|
|
5851
|
+
"The scenario's live analysis window, and the windowId its insights are keyed by."
|
|
5852
|
+
),
|
|
5853
|
+
getUserTestingSignalsOperation,
|
|
5854
|
+
(options) => ({
|
|
5855
|
+
project: options.project,
|
|
5856
|
+
scenario: options.scenario
|
|
5857
|
+
})
|
|
5858
|
+
);
|
|
5859
|
+
bindOperation(
|
|
5860
|
+
scenarioCommand(
|
|
5861
|
+
group,
|
|
5862
|
+
"insights",
|
|
5863
|
+
"The model's analysis of one window, if one has been requested. Not-found means nobody asked, which is different from asked-and-working."
|
|
5864
|
+
).requiredOption("--window <id>", "Window ID (from `signals`)"),
|
|
5865
|
+
getUserTestingInsightsOperation,
|
|
5866
|
+
(options) => ({
|
|
5867
|
+
project: options.project,
|
|
5868
|
+
scenario: options.scenario,
|
|
5869
|
+
window: options.window
|
|
5870
|
+
})
|
|
5871
|
+
);
|
|
5872
|
+
bindOperation(
|
|
5873
|
+
scenarioCommand(
|
|
5874
|
+
group,
|
|
5875
|
+
"request-insights",
|
|
5876
|
+
"Ask a model to analyze the current window. Returns pending; poll `insights`. SPENDS against a daily budget shared with swarm insights. A 409 means the window has not been mined yet \u2014 wait rather than retrying in a loop."
|
|
5877
|
+
).option("--force", "Regenerate over a window that already has insights."),
|
|
5878
|
+
requestUserTestingInsightsOperation,
|
|
5879
|
+
(options) => ({
|
|
5880
|
+
project: options.project,
|
|
5881
|
+
scenario: options.scenario,
|
|
5882
|
+
...options.force ? { force: true } : {}
|
|
5883
|
+
})
|
|
5884
|
+
);
|
|
5885
|
+
bindOperation(
|
|
5886
|
+
scenarioCommand(
|
|
5887
|
+
group,
|
|
5888
|
+
"cancel-insights",
|
|
5889
|
+
"Stop an in-flight generation. The recovery path for a window stuck pending \u2014 without it the only way forward is --force, which spends again."
|
|
5890
|
+
).requiredOption("--window <id>", "Window ID"),
|
|
5891
|
+
cancelUserTestingInsightsOperation,
|
|
5892
|
+
(options) => ({
|
|
5893
|
+
project: options.project,
|
|
5894
|
+
scenario: options.scenario,
|
|
5895
|
+
window: options.window
|
|
5896
|
+
})
|
|
5897
|
+
);
|
|
5898
|
+
bindOperation(
|
|
5899
|
+
scenarioCommand(
|
|
5900
|
+
group,
|
|
5901
|
+
"dismiss-finding",
|
|
5902
|
+
"Mark a finding as not worth acting on. Its lifecycle keeps updating underneath."
|
|
5903
|
+
).requiredOption("--finding <id>", "Finding ID"),
|
|
5904
|
+
dismissUserTestingFindingOperation,
|
|
5905
|
+
(options) => ({
|
|
5906
|
+
project: options.project,
|
|
5907
|
+
scenario: options.scenario,
|
|
5908
|
+
finding: options.finding
|
|
5909
|
+
})
|
|
5910
|
+
);
|
|
5911
|
+
bindOperation(
|
|
5912
|
+
scenarioCommand(
|
|
5913
|
+
group,
|
|
5914
|
+
"undismiss-finding",
|
|
5915
|
+
"Bring a dismissed finding back into the active list."
|
|
5916
|
+
).requiredOption("--finding <id>", "Finding ID"),
|
|
5917
|
+
undismissUserTestingFindingOperation,
|
|
5918
|
+
(options) => ({
|
|
5919
|
+
project: options.project,
|
|
5920
|
+
scenario: options.scenario,
|
|
5921
|
+
finding: options.finding
|
|
5922
|
+
})
|
|
5923
|
+
);
|
|
5924
|
+
bindOperation(
|
|
5925
|
+
scenarioCommand(
|
|
5926
|
+
group,
|
|
5927
|
+
"update",
|
|
5928
|
+
"Rename a scenario, or change who may open its share link. --mode must be used ON ITS OWN: identity and exposure are separate operations upstream, and mixing them could leave the scenario live in a mode you did not ask for."
|
|
5929
|
+
).option("--name <name>").option("--description <text>").option(
|
|
5930
|
+
"--mode <mode>",
|
|
5931
|
+
"project_members | invited_only | anyone_with_link"
|
|
5932
|
+
),
|
|
5933
|
+
updateUserTestingScenarioOperation,
|
|
5934
|
+
(options) => ({
|
|
5935
|
+
project: options.project,
|
|
5936
|
+
scenario: options.scenario,
|
|
5937
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
5938
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
5939
|
+
...options.mode !== void 0 ? { mode: options.mode } : {}
|
|
5940
|
+
})
|
|
5941
|
+
);
|
|
5942
|
+
bindOperation(
|
|
5943
|
+
scenarioCommand(
|
|
5944
|
+
group,
|
|
5945
|
+
"guest-execution",
|
|
5946
|
+
"Set what anonymous visitors may run on your account, and how much. A FULL REPLACEMENT: every flag is required, because these caps only mean something as a set and raising one while leaving a stale sibling produces a combination nobody chose."
|
|
5947
|
+
).requiredOption("--enabled <bool>", "true | false").requiredOption("--computer-enabled <bool>", "true | false").requiredOption("--shared-skills-enabled <bool>", "true | false").requiredOption(
|
|
5948
|
+
"--daily-credit-cap <n>",
|
|
5949
|
+
"Hard ceiling on visitor spend per day, in credits"
|
|
5950
|
+
).requiredOption("--daily-computer-start-cap <n>").requiredOption("--max-concurrent-computers <n>").option(
|
|
5951
|
+
"--harness-enabled <bool>",
|
|
5952
|
+
"true | false. Omitting this REPLACES any existing harness setting with 'disabled'."
|
|
5953
|
+
).option("--daily-harness-spend-cap-micros <n>").option("--daily-harness-call-cap <n>").option("--max-concurrent-harness-runs <n>"),
|
|
5954
|
+
setUserTestingGuestExecutionOperation,
|
|
5955
|
+
(options) => {
|
|
5956
|
+
if (options.harnessEnabled === void 0 && (options.dailyHarnessSpendCapMicros !== void 0 || options.dailyHarnessCallCap !== void 0 || options.maxConcurrentHarnessRuns !== void 0)) {
|
|
5957
|
+
throw usageError(
|
|
5958
|
+
"--harness-enabled is required when any harness cap is given: omitting it disables the harness, so the caps would land on nothing."
|
|
5959
|
+
);
|
|
5960
|
+
}
|
|
5961
|
+
return {
|
|
5962
|
+
project: options.project,
|
|
5963
|
+
scenario: options.scenario,
|
|
5964
|
+
enabled: parseBooleanFlag(options.enabled, "--enabled"),
|
|
5965
|
+
computerEnabled: parseBooleanFlag(
|
|
5966
|
+
options.computerEnabled,
|
|
5967
|
+
"--computer-enabled"
|
|
5968
|
+
),
|
|
5969
|
+
sharedSkillsEnabled: parseBooleanFlag(
|
|
5970
|
+
options.sharedSkillsEnabled,
|
|
5971
|
+
"--shared-skills-enabled"
|
|
5972
|
+
),
|
|
5973
|
+
dailyCreditCap: parseNumberFlag(
|
|
5974
|
+
options.dailyCreditCap,
|
|
5975
|
+
"--daily-credit-cap"
|
|
5976
|
+
),
|
|
5977
|
+
dailyComputerStartCap: parseRequiredIntegerOption(
|
|
5978
|
+
options.dailyComputerStartCap,
|
|
5979
|
+
"--daily-computer-start-cap"
|
|
5980
|
+
),
|
|
5981
|
+
maxConcurrentComputers: parseRequiredIntegerOption(
|
|
5982
|
+
options.maxConcurrentComputers,
|
|
5983
|
+
"--max-concurrent-computers"
|
|
5984
|
+
),
|
|
5985
|
+
...options.harnessEnabled !== void 0 ? {
|
|
5986
|
+
harnessEnabled: parseBooleanFlag(
|
|
5987
|
+
options.harnessEnabled,
|
|
5988
|
+
"--harness-enabled"
|
|
5989
|
+
)
|
|
5990
|
+
} : {},
|
|
5991
|
+
...options.dailyHarnessSpendCapMicros !== void 0 ? {
|
|
5992
|
+
dailyHarnessSpendCapMicros: parseIntegerOption(
|
|
5993
|
+
options.dailyHarnessSpendCapMicros,
|
|
5994
|
+
"--daily-harness-spend-cap-micros"
|
|
5995
|
+
)
|
|
5996
|
+
} : {},
|
|
5997
|
+
...options.dailyHarnessCallCap !== void 0 ? {
|
|
5998
|
+
dailyHarnessCallCap: parseIntegerOption(
|
|
5999
|
+
options.dailyHarnessCallCap,
|
|
6000
|
+
"--daily-harness-call-cap"
|
|
6001
|
+
)
|
|
6002
|
+
} : {},
|
|
6003
|
+
...options.maxConcurrentHarnessRuns !== void 0 ? {
|
|
6004
|
+
maxConcurrentHarnessRuns: parseIntegerOption(
|
|
6005
|
+
options.maxConcurrentHarnessRuns,
|
|
6006
|
+
"--max-concurrent-harness-runs"
|
|
6007
|
+
)
|
|
6008
|
+
} : {}
|
|
6009
|
+
};
|
|
6010
|
+
}
|
|
6011
|
+
);
|
|
6012
|
+
bindOperation(
|
|
6013
|
+
scenarioCommand(
|
|
6014
|
+
group,
|
|
6015
|
+
"rotate-link",
|
|
6016
|
+
"Mint a new share link and invalidate the old one. IMMEDIATE AND IRREVERSIBLE: everyone holding the old URL loses access and every live session on it dies. This is what you do when a link has leaked."
|
|
6017
|
+
),
|
|
6018
|
+
rotateUserTestingLinkOperation,
|
|
6019
|
+
(options) => ({
|
|
6020
|
+
project: options.project,
|
|
6021
|
+
scenario: options.scenario
|
|
6022
|
+
})
|
|
6023
|
+
);
|
|
6024
|
+
bindOperation(
|
|
6025
|
+
scenarioCommand(
|
|
6026
|
+
group,
|
|
6027
|
+
"invite",
|
|
6028
|
+
"Grant one person access by email. Upsert, so re-inviting an existing member is not an error."
|
|
6029
|
+
).requiredOption("--email <email>").option("--send-invite-email", "Also email them. Off by default."),
|
|
6030
|
+
upsertUserTestingMemberOperation,
|
|
6031
|
+
(options) => ({
|
|
6032
|
+
project: options.project,
|
|
6033
|
+
scenario: options.scenario,
|
|
6034
|
+
email: options.email,
|
|
6035
|
+
...options.sendInviteEmail ? { sendInviteEmail: true } : {}
|
|
6036
|
+
})
|
|
6037
|
+
);
|
|
6038
|
+
bindOperation(
|
|
6039
|
+
scenarioCommand(
|
|
6040
|
+
group,
|
|
6041
|
+
"remove-member",
|
|
6042
|
+
"Revoke one person's access."
|
|
6043
|
+
).requiredOption("--member <id-or-email>"),
|
|
6044
|
+
removeUserTestingMemberOperation,
|
|
6045
|
+
(options) => ({
|
|
6046
|
+
project: options.project,
|
|
6047
|
+
scenario: options.scenario,
|
|
6048
|
+
member: options.member
|
|
6049
|
+
})
|
|
6050
|
+
);
|
|
6051
|
+
bindOperation(
|
|
6052
|
+
scenarioCommand(
|
|
6053
|
+
group,
|
|
6054
|
+
"rebind",
|
|
6055
|
+
"Point a scenario at a different environment, KEEPING its link, members and session history. The alternative \u2014 unpublish and republish \u2014 mints a new link, which means re-sharing it with everyone."
|
|
6056
|
+
).requiredOption("--environment <id>", "Project environment ID"),
|
|
6057
|
+
rebindUserTestingScenarioOperation,
|
|
6058
|
+
(options) => ({
|
|
6059
|
+
project: options.project,
|
|
6060
|
+
scenario: options.scenario,
|
|
6061
|
+
environmentId: options.environment
|
|
6062
|
+
})
|
|
6063
|
+
);
|
|
6064
|
+
}
|
|
6065
|
+
function parseBooleanFlag(value, flag) {
|
|
6066
|
+
const normalized = value.trim().toLowerCase();
|
|
6067
|
+
if (normalized === "true") return true;
|
|
6068
|
+
if (normalized === "false") return false;
|
|
6069
|
+
throw new Error(`${flag} must be true or false`);
|
|
6070
|
+
}
|
|
6071
|
+
function parseNumberFlag(value, flag) {
|
|
6072
|
+
const parsed = Number(value);
|
|
6073
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
6074
|
+
throw new Error(`${flag} must be a non-negative number`);
|
|
6075
|
+
}
|
|
6076
|
+
return parsed;
|
|
6077
|
+
}
|
|
5185
6078
|
|
|
5186
6079
|
// src/lib/eval-screenshots.ts
|
|
5187
6080
|
function asRecord(value) {
|
|
@@ -5293,7 +6186,7 @@ function encodeInlineImage(data, protocol) {
|
|
|
5293
6186
|
}
|
|
5294
6187
|
|
|
5295
6188
|
// src/commands/eval.ts
|
|
5296
|
-
function
|
|
6189
|
+
function addPlatformOptions7(command) {
|
|
5297
6190
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
5298
6191
|
"--api-url <url>",
|
|
5299
6192
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
@@ -5312,7 +6205,7 @@ function writeRunLink(format, webOrigin, run) {
|
|
|
5312
6205
|
`
|
|
5313
6206
|
);
|
|
5314
6207
|
}
|
|
5315
|
-
async function
|
|
6208
|
+
async function runPlatformCommand7(options, timeoutMs, execute) {
|
|
5316
6209
|
const controller = new AbortController();
|
|
5317
6210
|
const timeoutHandle = setTimeout(() => {
|
|
5318
6211
|
controller.abort(
|
|
@@ -5426,7 +6319,7 @@ function validateOpInput2(op, raw) {
|
|
|
5426
6319
|
}
|
|
5427
6320
|
async function executeOp2(op, input, options, command) {
|
|
5428
6321
|
const globalOptions = getGlobalOptions(command);
|
|
5429
|
-
const result = await
|
|
6322
|
+
const result = await runPlatformCommand7(
|
|
5430
6323
|
options,
|
|
5431
6324
|
globalOptions.timeout,
|
|
5432
6325
|
({ client, signal }) => op.execute(input, { client, signal })
|
|
@@ -5526,7 +6419,7 @@ function resolveScreenshotPath(out, shot, index, total) {
|
|
|
5526
6419
|
}
|
|
5527
6420
|
function registerEvalCommands(program) {
|
|
5528
6421
|
const evals = program.command("eval").description("Author and run eval suites in your hosted MCPJam projects");
|
|
5529
|
-
|
|
6422
|
+
addPlatformOptions7(
|
|
5530
6423
|
evals.command("create").description(
|
|
5531
6424
|
"Create a runnable eval suite from authored test cases (does not run it)"
|
|
5532
6425
|
).option(
|
|
@@ -5551,21 +6444,21 @@ function registerEvalCommands(program) {
|
|
|
5551
6444
|
).action(async (options, command) => {
|
|
5552
6445
|
const globalOptions = getGlobalOptions(command);
|
|
5553
6446
|
const input = loadSuiteDefinition(options);
|
|
5554
|
-
const result = await
|
|
6447
|
+
const result = await runPlatformCommand7(
|
|
5555
6448
|
options,
|
|
5556
6449
|
globalOptions.timeout,
|
|
5557
6450
|
({ client, signal }) => createEvalSuiteOperation.execute(input, { client, signal })
|
|
5558
6451
|
);
|
|
5559
6452
|
writeResult(result, globalOptions.format);
|
|
5560
6453
|
});
|
|
5561
|
-
|
|
6454
|
+
addPlatformOptions7(
|
|
5562
6455
|
evals.command("list").description("List the eval suites saved in a project").option(
|
|
5563
6456
|
"--project <id-or-name>",
|
|
5564
6457
|
"Project name or ID (defaults to the most recently updated project)"
|
|
5565
6458
|
)
|
|
5566
6459
|
).action(async (options, command) => {
|
|
5567
6460
|
const globalOptions = getGlobalOptions(command);
|
|
5568
|
-
const result = await
|
|
6461
|
+
const result = await runPlatformCommand7(
|
|
5569
6462
|
options,
|
|
5570
6463
|
globalOptions.timeout,
|
|
5571
6464
|
({ client, signal }) => listEvalSuitesOperation.execute(
|
|
@@ -5575,7 +6468,7 @@ function registerEvalCommands(program) {
|
|
|
5575
6468
|
);
|
|
5576
6469
|
writeResult(result, globalOptions.format);
|
|
5577
6470
|
});
|
|
5578
|
-
|
|
6471
|
+
addPlatformOptions7(
|
|
5579
6472
|
evals.command("runs").description("List a suite's run history, newest first").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option(
|
|
5580
6473
|
"--project <id-or-name>",
|
|
5581
6474
|
"Project name or ID (defaults to the most recently updated project)"
|
|
@@ -5594,7 +6487,7 @@ function registerEvalCommands(program) {
|
|
|
5594
6487
|
await executeOp2(listEvalSuiteRunsOperation, input, options, command);
|
|
5595
6488
|
}
|
|
5596
6489
|
);
|
|
5597
|
-
|
|
6490
|
+
addPlatformOptions7(
|
|
5598
6491
|
evals.command("run").description("Start an eval run of an existing suite (asynchronous)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option(
|
|
5599
6492
|
"--project <id-or-name>",
|
|
5600
6493
|
"Project name or ID (defaults to the most recently updated project)"
|
|
@@ -5609,7 +6502,7 @@ function registerEvalCommands(program) {
|
|
|
5609
6502
|
async (options, command) => {
|
|
5610
6503
|
const globalOptions = getGlobalOptions(command);
|
|
5611
6504
|
let webOrigin = DEFAULT_PLATFORM_ORIGIN;
|
|
5612
|
-
const result = await
|
|
6505
|
+
const result = await runPlatformCommand7(
|
|
5613
6506
|
options,
|
|
5614
6507
|
globalOptions.timeout,
|
|
5615
6508
|
(context) => {
|
|
@@ -5633,13 +6526,13 @@ function registerEvalCommands(program) {
|
|
|
5633
6526
|
});
|
|
5634
6527
|
}
|
|
5635
6528
|
);
|
|
5636
|
-
|
|
6529
|
+
addPlatformOptions7(
|
|
5637
6530
|
evals.command("status").description("Get the status and summary of an eval run").requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
|
|
5638
6531
|
).action(
|
|
5639
6532
|
async (options, command) => {
|
|
5640
6533
|
const globalOptions = getGlobalOptions(command);
|
|
5641
6534
|
let webOrigin = DEFAULT_PLATFORM_ORIGIN;
|
|
5642
|
-
const result = await
|
|
6535
|
+
const result = await runPlatformCommand7(
|
|
5643
6536
|
options,
|
|
5644
6537
|
globalOptions.timeout,
|
|
5645
6538
|
(context) => {
|
|
@@ -5658,7 +6551,7 @@ function registerEvalCommands(program) {
|
|
|
5658
6551
|
});
|
|
5659
6552
|
}
|
|
5660
6553
|
);
|
|
5661
|
-
|
|
6554
|
+
addPlatformOptions7(
|
|
5662
6555
|
evals.command("cancel").description(
|
|
5663
6556
|
"Cancel an in-flight eval run (no-op if already cancelled; errors if it already finished)"
|
|
5664
6557
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
|
|
@@ -5673,7 +6566,7 @@ function registerEvalCommands(program) {
|
|
|
5673
6566
|
}
|
|
5674
6567
|
);
|
|
5675
6568
|
const PROJECT_OPT = "Project name or ID (defaults to most recently updated)";
|
|
5676
|
-
|
|
6569
|
+
addPlatformOptions7(
|
|
5677
6570
|
evals.command("iterations").description(
|
|
5678
6571
|
"List per-iteration results for an eval run (pass/fail, tool calls, tokens, latency)"
|
|
5679
6572
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -5691,7 +6584,7 @@ function registerEvalCommands(program) {
|
|
|
5691
6584
|
await executeOp2(listEvalRunIterationsOperation, input, options, command);
|
|
5692
6585
|
}
|
|
5693
6586
|
);
|
|
5694
|
-
|
|
6587
|
+
addPlatformOptions7(
|
|
5695
6588
|
evals.command("trace").description(
|
|
5696
6589
|
"Fetch the full trace for one eval iteration (large: full message history + spans)"
|
|
5697
6590
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -5715,7 +6608,7 @@ function registerEvalCommands(program) {
|
|
|
5715
6608
|
);
|
|
5716
6609
|
}
|
|
5717
6610
|
);
|
|
5718
|
-
|
|
6611
|
+
addPlatformOptions7(
|
|
5719
6612
|
evals.command("steps").description(
|
|
5720
6613
|
"Per-authored-step results for one eval iteration: status (ok/fail/skipped/pending), reason, and evidence (screenshot/video URLs). The fastest way to see WHICH step failed and why."
|
|
5721
6614
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -5739,7 +6632,7 @@ function registerEvalCommands(program) {
|
|
|
5739
6632
|
);
|
|
5740
6633
|
}
|
|
5741
6634
|
);
|
|
5742
|
-
|
|
6635
|
+
addPlatformOptions7(
|
|
5743
6636
|
evals.command("screenshot").description(
|
|
5744
6637
|
"Show the widget screenshot(s) an eval iteration rendered \u2014 inline when the terminal supports it, otherwise the image URL"
|
|
5745
6638
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -5756,7 +6649,7 @@ function registerEvalCommands(program) {
|
|
|
5756
6649
|
async (options, command) => {
|
|
5757
6650
|
const globalOptions = getGlobalOptions(command);
|
|
5758
6651
|
const index = options.index !== void 0 ? parsePositiveInteger(options.index, "--index") : void 0;
|
|
5759
|
-
const result = await
|
|
6652
|
+
const result = await runPlatformCommand7(
|
|
5760
6653
|
options,
|
|
5761
6654
|
globalOptions.timeout,
|
|
5762
6655
|
({ client, signal }) => getEvalIterationTraceOperation.execute(
|
|
@@ -5847,7 +6740,7 @@ function registerEvalCommands(program) {
|
|
|
5847
6740
|
}
|
|
5848
6741
|
}
|
|
5849
6742
|
);
|
|
5850
|
-
|
|
6743
|
+
addPlatformOptions7(
|
|
5851
6744
|
evals.command("video").description(
|
|
5852
6745
|
"Get the Playwright replay video (.webm) an eval iteration recorded \u2014 prints the URL, or downloads it with --out"
|
|
5853
6746
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -5860,7 +6753,7 @@ function registerEvalCommands(program) {
|
|
|
5860
6753
|
).action(
|
|
5861
6754
|
async (options, command) => {
|
|
5862
6755
|
const globalOptions = getGlobalOptions(command);
|
|
5863
|
-
const result = await
|
|
6756
|
+
const result = await runPlatformCommand7(
|
|
5864
6757
|
options,
|
|
5865
6758
|
globalOptions.timeout,
|
|
5866
6759
|
({ client, signal }) => getEvalIterationTraceOperation.execute(
|
|
@@ -5911,7 +6804,7 @@ function registerEvalCommands(program) {
|
|
|
5911
6804
|
`);
|
|
5912
6805
|
}
|
|
5913
6806
|
);
|
|
5914
|
-
|
|
6807
|
+
addPlatformOptions7(
|
|
5915
6808
|
evals.command("get").description("Show an eval suite's full settings").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
5916
6809
|
).action(
|
|
5917
6810
|
async (options, command) => {
|
|
@@ -5923,7 +6816,7 @@ function registerEvalCommands(program) {
|
|
|
5923
6816
|
);
|
|
5924
6817
|
}
|
|
5925
6818
|
);
|
|
5926
|
-
|
|
6819
|
+
addPlatformOptions7(
|
|
5927
6820
|
evals.command("update").description(
|
|
5928
6821
|
"Edit an eval suite's settings (only the flags you pass change)"
|
|
5929
6822
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Suite-update JSON body (or - for stdin)").option("--json <json>", "Inline suite-update JSON (or @file, or -)").option("--name <name>", "Rename the suite").option("--description <text>", "Suite description").option(
|
|
@@ -5937,7 +6830,7 @@ function registerEvalCommands(program) {
|
|
|
5937
6830
|
);
|
|
5938
6831
|
await executeOp2(updateEvalSuiteOperation, input, options, command);
|
|
5939
6832
|
});
|
|
5940
|
-
|
|
6833
|
+
addPlatformOptions7(
|
|
5941
6834
|
evals.command("delete").description("Permanently delete an eval suite (and its cases and runs)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
5942
6835
|
).action(
|
|
5943
6836
|
async (options, command) => {
|
|
@@ -5949,7 +6842,7 @@ function registerEvalCommands(program) {
|
|
|
5949
6842
|
);
|
|
5950
6843
|
}
|
|
5951
6844
|
);
|
|
5952
|
-
|
|
6845
|
+
addPlatformOptions7(
|
|
5953
6846
|
evals.command("schedule").description("Enable or disable scheduled runs for a suite").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--enable", "Enable scheduled runs").option("--disable", "Disable scheduled runs").option("--interval <minutes>", "Run interval in minutes (5\u201310080)").option(
|
|
5954
6847
|
"--environment <id-or-name>",
|
|
5955
6848
|
"Project environment the scheduled runs launch (only with --enable)"
|
|
@@ -5975,7 +6868,7 @@ function registerEvalCommands(program) {
|
|
|
5975
6868
|
const environments = evals.command("environments").description(
|
|
5976
6869
|
"Attach or detach the project environments an eval suite runs against"
|
|
5977
6870
|
);
|
|
5978
|
-
|
|
6871
|
+
addPlatformOptions7(
|
|
5979
6872
|
environments.command("set").description(
|
|
5980
6873
|
"Replace the suite's attached environments (this sets the whole list)"
|
|
5981
6874
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption(
|
|
@@ -5996,7 +6889,7 @@ function registerEvalCommands(program) {
|
|
|
5996
6889
|
);
|
|
5997
6890
|
}
|
|
5998
6891
|
);
|
|
5999
|
-
|
|
6892
|
+
addPlatformOptions7(
|
|
6000
6893
|
environments.command("clear").description(
|
|
6001
6894
|
"Detach every environment, reverting the suite to its saved server selection"
|
|
6002
6895
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
@@ -6015,7 +6908,7 @@ function registerEvalCommands(program) {
|
|
|
6015
6908
|
}
|
|
6016
6909
|
);
|
|
6017
6910
|
const cases = evals.command("cases").description("List, author, and edit an eval suite's test cases");
|
|
6018
|
-
|
|
6911
|
+
addPlatformOptions7(
|
|
6019
6912
|
cases.command("list").description("List a suite's test cases").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
6020
6913
|
).action(
|
|
6021
6914
|
async (options, command) => {
|
|
@@ -6027,7 +6920,7 @@ function registerEvalCommands(program) {
|
|
|
6027
6920
|
);
|
|
6028
6921
|
}
|
|
6029
6922
|
);
|
|
6030
|
-
|
|
6923
|
+
addPlatformOptions7(
|
|
6031
6924
|
cases.command("get").description("Show one test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
6032
6925
|
).action(
|
|
6033
6926
|
async (options, command) => {
|
|
@@ -6039,7 +6932,7 @@ function registerEvalCommands(program) {
|
|
|
6039
6932
|
);
|
|
6040
6933
|
}
|
|
6041
6934
|
);
|
|
6042
|
-
|
|
6935
|
+
addPlatformOptions7(
|
|
6043
6936
|
cases.command("run").description(
|
|
6044
6937
|
"Run a single case as a persisted, fully-queryable run (inspect it with `eval iterations` / `eval steps` like any run)"
|
|
6045
6938
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT).option(
|
|
@@ -6065,7 +6958,7 @@ function registerEvalCommands(program) {
|
|
|
6065
6958
|
);
|
|
6066
6959
|
}
|
|
6067
6960
|
);
|
|
6068
|
-
|
|
6961
|
+
addPlatformOptions7(
|
|
6069
6962
|
cases.command("create").description("Add a test case to a suite (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Case title (overrides the body)")
|
|
6070
6963
|
).action(async (options, command) => {
|
|
6071
6964
|
const input = validateOpInput2(
|
|
@@ -6074,7 +6967,7 @@ function registerEvalCommands(program) {
|
|
|
6074
6967
|
);
|
|
6075
6968
|
await executeOp2(createEvalCaseOperation, input, options, command);
|
|
6076
6969
|
});
|
|
6077
|
-
|
|
6970
|
+
addPlatformOptions7(
|
|
6078
6971
|
cases.command("update").description("Edit a test case (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Rename the case")
|
|
6079
6972
|
).action(async (options, command) => {
|
|
6080
6973
|
const input = validateOpInput2(
|
|
@@ -6083,7 +6976,7 @@ function registerEvalCommands(program) {
|
|
|
6083
6976
|
);
|
|
6084
6977
|
await executeOp2(updateEvalCaseOperation, input, options, command);
|
|
6085
6978
|
});
|
|
6086
|
-
|
|
6979
|
+
addPlatformOptions7(
|
|
6087
6980
|
cases.command("delete").description("Permanently delete a test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
6088
6981
|
).action(
|
|
6089
6982
|
async (options, command) => {
|
|
@@ -6095,7 +6988,7 @@ function registerEvalCommands(program) {
|
|
|
6095
6988
|
);
|
|
6096
6989
|
}
|
|
6097
6990
|
);
|
|
6098
|
-
|
|
6991
|
+
addPlatformOptions7(
|
|
6099
6992
|
cases.command("generate").description(
|
|
6100
6993
|
"AI-generate test cases from the suite's tools (spends credits)"
|
|
6101
6994
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--mode <normal|negative>", "Generation mode (default normal)").option(
|
|
@@ -6148,13 +7041,13 @@ function registerEvalCommands(program) {
|
|
|
6148
7041
|
);
|
|
6149
7042
|
}
|
|
6150
7043
|
var HOST_TEMPLATES = HOST_TEMPLATES$1.map(({ id, label }) => ({ id, label }));
|
|
6151
|
-
function
|
|
7044
|
+
function addPlatformOptions8(command) {
|
|
6152
7045
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
6153
7046
|
"--api-url <url>",
|
|
6154
7047
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
6155
7048
|
);
|
|
6156
7049
|
}
|
|
6157
|
-
async function
|
|
7050
|
+
async function runPlatformCommand8(options, timeoutMs, execute) {
|
|
6158
7051
|
const controller = new AbortController();
|
|
6159
7052
|
const timeoutHandle = setTimeout(() => {
|
|
6160
7053
|
controller.abort(
|
|
@@ -6222,14 +7115,14 @@ function registerHostsCommands(program) {
|
|
|
6222
7115
|
const globalOptions = getGlobalOptions(command);
|
|
6223
7116
|
writeResult({ items: HOST_TEMPLATES }, globalOptions.format);
|
|
6224
7117
|
});
|
|
6225
|
-
|
|
7118
|
+
addPlatformOptions8(
|
|
6226
7119
|
hosts.command("list").description("List the hosts saved in a project").option(
|
|
6227
7120
|
"--project <id-or-name>",
|
|
6228
7121
|
"Project name or ID (defaults to the most recently updated project)"
|
|
6229
7122
|
)
|
|
6230
7123
|
).action(async (options, command) => {
|
|
6231
7124
|
const globalOptions = getGlobalOptions(command);
|
|
6232
|
-
const result = await
|
|
7125
|
+
const result = await runPlatformCommand8(
|
|
6233
7126
|
options,
|
|
6234
7127
|
globalOptions.timeout,
|
|
6235
7128
|
({ client, signal }) => listHostsOperation.execute(
|
|
@@ -6239,12 +7132,12 @@ function registerHostsCommands(program) {
|
|
|
6239
7132
|
);
|
|
6240
7133
|
writeResult(result, globalOptions.format);
|
|
6241
7134
|
});
|
|
6242
|
-
|
|
7135
|
+
addPlatformOptions8(
|
|
6243
7136
|
hosts.command("get").description("Show one host's full settings, including its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
6244
7137
|
).action(
|
|
6245
7138
|
async (options, command) => {
|
|
6246
7139
|
const globalOptions = getGlobalOptions(command);
|
|
6247
|
-
const result = await
|
|
7140
|
+
const result = await runPlatformCommand8(
|
|
6248
7141
|
options,
|
|
6249
7142
|
globalOptions.timeout,
|
|
6250
7143
|
({ client, signal }) => getHostOperation.execute(
|
|
@@ -6255,7 +7148,7 @@ function registerHostsCommands(program) {
|
|
|
6255
7148
|
writeResult(result, globalOptions.format);
|
|
6256
7149
|
}
|
|
6257
7150
|
);
|
|
6258
|
-
|
|
7151
|
+
addPlatformOptions8(
|
|
6259
7152
|
hosts.command("create").description(
|
|
6260
7153
|
"Create a host from a built-in template (--template) or a full host config (--file/--json)"
|
|
6261
7154
|
).requiredOption("--name <name>", "Display name for the new host").option("--project <id-or-name>", "Project name or ID").option(
|
|
@@ -6276,7 +7169,7 @@ function registerHostsCommands(program) {
|
|
|
6276
7169
|
...options.theme !== void 0 ? { theme: options.theme } : {},
|
|
6277
7170
|
...config !== void 0 ? { config } : {}
|
|
6278
7171
|
});
|
|
6279
|
-
const result = await
|
|
7172
|
+
const result = await runPlatformCommand8(
|
|
6280
7173
|
options,
|
|
6281
7174
|
globalOptions.timeout,
|
|
6282
7175
|
({ client, signal }) => createHostOperation.execute(input, { client, signal })
|
|
@@ -6284,7 +7177,7 @@ function registerHostsCommands(program) {
|
|
|
6284
7177
|
writeResult(result, globalOptions.format);
|
|
6285
7178
|
}
|
|
6286
7179
|
);
|
|
6287
|
-
|
|
7180
|
+
addPlatformOptions8(
|
|
6288
7181
|
hosts.command("update").description("Edit a host's name and/or its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID").option("--name <name>", "New display name").option(
|
|
6289
7182
|
"--file <path>",
|
|
6290
7183
|
"Replacement host config v2 JSON (or - for stdin)"
|
|
@@ -6302,7 +7195,7 @@ function registerHostsCommands(program) {
|
|
|
6302
7195
|
...options.name !== void 0 ? { name: options.name } : {},
|
|
6303
7196
|
...config !== void 0 ? { config } : {}
|
|
6304
7197
|
});
|
|
6305
|
-
const result = await
|
|
7198
|
+
const result = await runPlatformCommand8(
|
|
6306
7199
|
options,
|
|
6307
7200
|
globalOptions.timeout,
|
|
6308
7201
|
({ client, signal }) => updateHostOperation.execute(input, { client, signal })
|
|
@@ -6310,12 +7203,12 @@ function registerHostsCommands(program) {
|
|
|
6310
7203
|
writeResult(result, globalOptions.format);
|
|
6311
7204
|
}
|
|
6312
7205
|
);
|
|
6313
|
-
|
|
7206
|
+
addPlatformOptions8(
|
|
6314
7207
|
hosts.command("delete").description("Permanently delete a host from a project").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
6315
7208
|
).action(
|
|
6316
7209
|
async (options, command) => {
|
|
6317
7210
|
const globalOptions = getGlobalOptions(command);
|
|
6318
|
-
const result = await
|
|
7211
|
+
const result = await runPlatformCommand8(
|
|
6319
7212
|
options,
|
|
6320
7213
|
globalOptions.timeout,
|
|
6321
7214
|
({ client, signal }) => deleteHostOperation.execute(
|
|
@@ -6329,7 +7222,7 @@ function registerHostsCommands(program) {
|
|
|
6329
7222
|
writeResult(result, globalOptions.format);
|
|
6330
7223
|
}
|
|
6331
7224
|
);
|
|
6332
|
-
|
|
7225
|
+
addPlatformOptions8(
|
|
6333
7226
|
hosts.command("servers").description("Replace a host's required and optional server attachments").requiredOption("--host <id-or-name>", "Host name or ID").requiredOption(
|
|
6334
7227
|
"--server-ids <ids>",
|
|
6335
7228
|
"Comma-separated required server IDs"
|
|
@@ -6347,7 +7240,7 @@ function registerHostsCommands(program) {
|
|
|
6347
7240
|
serverIds: splitIds(options.serverIds),
|
|
6348
7241
|
...options.optionalServerIds ? { optionalServerIds: splitIds(options.optionalServerIds) } : {}
|
|
6349
7242
|
});
|
|
6350
|
-
const result = await
|
|
7243
|
+
const result = await runPlatformCommand8(
|
|
6351
7244
|
options,
|
|
6352
7245
|
globalOptions.timeout,
|
|
6353
7246
|
({ client, signal }) => setHostServersOperation.execute(input, { client, signal })
|
|
@@ -6355,7 +7248,7 @@ function registerHostsCommands(program) {
|
|
|
6355
7248
|
writeResult(result, globalOptions.format);
|
|
6356
7249
|
}
|
|
6357
7250
|
);
|
|
6358
|
-
|
|
7251
|
+
addPlatformOptions8(
|
|
6359
7252
|
hosts.command("duplicate").description("Duplicate a host's current config").requiredOption("--host <id-or-name>", "Host name or ID").option("--name <name>", "Name for the new host").option("--project <id-or-name>", "Project name or ID")
|
|
6360
7253
|
).action(
|
|
6361
7254
|
async (options, command) => {
|
|
@@ -6365,7 +7258,7 @@ function registerHostsCommands(program) {
|
|
|
6365
7258
|
host: options.host,
|
|
6366
7259
|
...options.name === void 0 ? {} : { name: options.name }
|
|
6367
7260
|
});
|
|
6368
|
-
const result = await
|
|
7261
|
+
const result = await runPlatformCommand8(
|
|
6369
7262
|
options,
|
|
6370
7263
|
globalOptions.timeout,
|
|
6371
7264
|
({ client, signal }) => duplicateHostOperation.execute(input, { client, signal })
|
|
@@ -7040,6 +7933,22 @@ function table(rows) {
|
|
|
7040
7933
|
).join(" ").trimEnd()
|
|
7041
7934
|
);
|
|
7042
7935
|
}
|
|
7936
|
+
function formatOrganizationsHuman(organizations) {
|
|
7937
|
+
if (organizations.length === 0) {
|
|
7938
|
+
return "No accessible organizations.";
|
|
7939
|
+
}
|
|
7940
|
+
const lines = table([
|
|
7941
|
+
["ID", "NAME", "PLAN", "ROLE"],
|
|
7942
|
+
...organizations.map((organization) => [
|
|
7943
|
+
organization.id,
|
|
7944
|
+
organization.name,
|
|
7945
|
+
organization.plan ?? "-",
|
|
7946
|
+
organization.myRole ?? "-"
|
|
7947
|
+
])
|
|
7948
|
+
]);
|
|
7949
|
+
lines.push("", `${organizations.length} organization(s).`);
|
|
7950
|
+
return lines.join("\n");
|
|
7951
|
+
}
|
|
7043
7952
|
function formatProjectsHuman(projects) {
|
|
7044
7953
|
if (projects.length === 0) {
|
|
7045
7954
|
return "No accessible projects.";
|
|
@@ -7131,7 +8040,61 @@ function statusGlyph(status) {
|
|
|
7131
8040
|
return "!";
|
|
7132
8041
|
}
|
|
7133
8042
|
}
|
|
7134
|
-
|
|
8043
|
+
|
|
8044
|
+
// src/commands/organizations.ts
|
|
8045
|
+
function addPlatformOptions9(command) {
|
|
8046
|
+
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
8047
|
+
"--api-url <url>",
|
|
8048
|
+
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
8049
|
+
);
|
|
8050
|
+
}
|
|
8051
|
+
async function runPlatformCommand9(options, timeoutMs, execute) {
|
|
8052
|
+
const controller = new AbortController();
|
|
8053
|
+
const timeoutHandle = setTimeout(() => {
|
|
8054
|
+
controller.abort(
|
|
8055
|
+
new PlatformApiError(`Request timed out after ${timeoutMs}ms`, "TIMEOUT", {
|
|
8056
|
+
status: 0
|
|
8057
|
+
})
|
|
8058
|
+
);
|
|
8059
|
+
}, timeoutMs);
|
|
8060
|
+
timeoutHandle.unref?.();
|
|
8061
|
+
try {
|
|
8062
|
+
const { client } = buildPlatformClient({ ...options, timeoutMs });
|
|
8063
|
+
return await execute({ client, signal: controller.signal });
|
|
8064
|
+
} catch (error) {
|
|
8065
|
+
if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
|
|
8066
|
+
throw toCliError(controller.signal.reason);
|
|
8067
|
+
}
|
|
8068
|
+
throw toCliError(error);
|
|
8069
|
+
} finally {
|
|
8070
|
+
clearTimeout(timeoutHandle);
|
|
8071
|
+
}
|
|
8072
|
+
}
|
|
8073
|
+
function registerOrganizationsCommands(program) {
|
|
8074
|
+
const organizations = program.command("organizations").alias("orgs").description("Inspect the MCPJam organizations you belong to");
|
|
8075
|
+
addPlatformOptions9(
|
|
8076
|
+
organizations.command("list").description(
|
|
8077
|
+
"List your organizations and their ids (an sk_ key sees only its own)"
|
|
8078
|
+
)
|
|
8079
|
+
// `--api-key` / `--api-url` are declared only here, not on the group, so
|
|
8080
|
+
// Commander hands them to this action directly — no `optsWithGlobals`
|
|
8081
|
+
// merge dance like `projects`, whose `servers` group duplicates them.
|
|
8082
|
+
).action(async (options, command) => {
|
|
8083
|
+
const globalOptions = getGlobalOptions(command);
|
|
8084
|
+
const result = await runPlatformCommand9(
|
|
8085
|
+
options,
|
|
8086
|
+
globalOptions.timeout,
|
|
8087
|
+
({ client, signal }) => listOrganizationsOperation.execute({}, { client, signal })
|
|
8088
|
+
);
|
|
8089
|
+
if (globalOptions.format === "human") {
|
|
8090
|
+
process.stdout.write(`${formatOrganizationsHuman(result.items)}
|
|
8091
|
+
`);
|
|
8092
|
+
} else {
|
|
8093
|
+
writeResult(result, globalOptions.format);
|
|
8094
|
+
}
|
|
8095
|
+
});
|
|
8096
|
+
}
|
|
8097
|
+
function addPlatformOptions10(command) {
|
|
7135
8098
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
7136
8099
|
"--api-url <url>",
|
|
7137
8100
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
@@ -7157,7 +8120,7 @@ function requireProject(command, options) {
|
|
|
7157
8120
|
}
|
|
7158
8121
|
return project;
|
|
7159
8122
|
}
|
|
7160
|
-
async function
|
|
8123
|
+
async function runPlatformCommand10(options, timeoutMs, execute, externalSignal) {
|
|
7161
8124
|
const controller = new AbortController();
|
|
7162
8125
|
const timeoutHandle = setTimeout(() => {
|
|
7163
8126
|
controller.abort(
|
|
@@ -7191,14 +8154,27 @@ function registerProjectsCommands(program) {
|
|
|
7191
8154
|
const projects = program.command("projects").description(
|
|
7192
8155
|
"Operate the MCP servers saved in your hosted MCPJam projects"
|
|
7193
8156
|
);
|
|
7194
|
-
|
|
7195
|
-
projects.command("list").description("List the projects you can access")
|
|
8157
|
+
addPlatformOptions10(
|
|
8158
|
+
projects.command("list").description("List the projects you can access").option(
|
|
8159
|
+
"--organization-id <id>",
|
|
8160
|
+
"Restrict the listing to one organization (see `mcpjam organizations list`)"
|
|
8161
|
+
)
|
|
7196
8162
|
).action(async (_options, command) => {
|
|
7197
8163
|
const globalOptions = getGlobalOptions(command);
|
|
7198
|
-
const
|
|
8164
|
+
const rawOrganization = command.opts().organizationId;
|
|
8165
|
+
if (rawOrganization !== void 0 && rawOrganization.trim() === "") {
|
|
8166
|
+
command.error(
|
|
8167
|
+
"error: option '--organization-id <id>' cannot be empty"
|
|
8168
|
+
);
|
|
8169
|
+
}
|
|
8170
|
+
const organizationId = rawOrganization?.trim();
|
|
8171
|
+
const result = await runPlatformCommand10(
|
|
7199
8172
|
platformOptionsOf(command),
|
|
7200
8173
|
globalOptions.timeout,
|
|
7201
|
-
({ client, signal }) => listProjectsOperation.execute(
|
|
8174
|
+
({ client, signal }) => listProjectsOperation.execute(
|
|
8175
|
+
organizationId ? { organizationId } : {},
|
|
8176
|
+
{ client, signal }
|
|
8177
|
+
)
|
|
7202
8178
|
);
|
|
7203
8179
|
if (globalOptions.format === "human") {
|
|
7204
8180
|
process.stdout.write(`${formatProjectsHuman(result.items)}
|
|
@@ -7207,7 +8183,7 @@ function registerProjectsCommands(program) {
|
|
|
7207
8183
|
writeResult(result, globalOptions.format);
|
|
7208
8184
|
}
|
|
7209
8185
|
});
|
|
7210
|
-
|
|
8186
|
+
addPlatformOptions10(
|
|
7211
8187
|
projects.command("create").description("Create a hosted MCPJam project").requiredOption("--name <name>", "Project name").option("--description <text>", "Project description").option("--organization-id <id>", "Organization ID").option("--visibility <visibility>", "public or private")
|
|
7212
8188
|
).action(
|
|
7213
8189
|
async (options, command) => {
|
|
@@ -7218,7 +8194,7 @@ function registerProjectsCommands(program) {
|
|
|
7218
8194
|
...options.organizationId === void 0 ? {} : { organizationId: options.organizationId },
|
|
7219
8195
|
...options.visibility === void 0 ? {} : { visibility: options.visibility }
|
|
7220
8196
|
});
|
|
7221
|
-
const result = await
|
|
8197
|
+
const result = await runPlatformCommand10(
|
|
7222
8198
|
platformOptionsOf(command),
|
|
7223
8199
|
globalOptions.timeout,
|
|
7224
8200
|
({ client, signal }) => createProjectOperation.execute(input, { client, signal })
|
|
@@ -7226,7 +8202,7 @@ function registerProjectsCommands(program) {
|
|
|
7226
8202
|
writeResult(result, globalOptions.format);
|
|
7227
8203
|
}
|
|
7228
8204
|
);
|
|
7229
|
-
|
|
8205
|
+
addPlatformOptions10(
|
|
7230
8206
|
projects.command("update").description("Update project metadata").requiredOption("--project <id-or-name>", "Project name or ID").option("--name <name>", "New project name").option("--description <text>", "New project description").option("--visibility <visibility>", "public or private")
|
|
7231
8207
|
).action(
|
|
7232
8208
|
async (options, command) => {
|
|
@@ -7238,7 +8214,7 @@ function registerProjectsCommands(program) {
|
|
|
7238
8214
|
...options.description === void 0 ? {} : { description: options.description },
|
|
7239
8215
|
...options.visibility === void 0 ? {} : { visibility: options.visibility }
|
|
7240
8216
|
});
|
|
7241
|
-
const result = await
|
|
8217
|
+
const result = await runPlatformCommand10(
|
|
7242
8218
|
platformOptions,
|
|
7243
8219
|
globalOptions.timeout,
|
|
7244
8220
|
({ client, signal }) => updateProjectOperation.execute(input, { client, signal })
|
|
@@ -7246,7 +8222,7 @@ function registerProjectsCommands(program) {
|
|
|
7246
8222
|
writeResult(result, globalOptions.format);
|
|
7247
8223
|
}
|
|
7248
8224
|
);
|
|
7249
|
-
|
|
8225
|
+
addPlatformOptions10(
|
|
7250
8226
|
projects.command("delete").description("Delete a project and its project-owned resources").requiredOption("--project <id-or-name>", "Project name or ID")
|
|
7251
8227
|
).action(async (_options, command) => {
|
|
7252
8228
|
const globalOptions = getGlobalOptions(command);
|
|
@@ -7254,14 +8230,14 @@ function registerProjectsCommands(program) {
|
|
|
7254
8230
|
const input = deleteProjectOperation.inputSchema.parse({
|
|
7255
8231
|
project: requireProject(command, platformOptions)
|
|
7256
8232
|
});
|
|
7257
|
-
const result = await
|
|
8233
|
+
const result = await runPlatformCommand10(
|
|
7258
8234
|
platformOptions,
|
|
7259
8235
|
globalOptions.timeout,
|
|
7260
8236
|
({ client, signal }) => deleteProjectOperation.execute(input, { client, signal })
|
|
7261
8237
|
);
|
|
7262
8238
|
writeResult(result, globalOptions.format);
|
|
7263
8239
|
});
|
|
7264
|
-
const servers =
|
|
8240
|
+
const servers = addPlatformOptions10(
|
|
7265
8241
|
projects.command("servers").alias("server").description("List and manage the servers saved in a project")
|
|
7266
8242
|
).option(
|
|
7267
8243
|
"--project <id-or-name>",
|
|
@@ -7270,7 +8246,7 @@ function registerProjectsCommands(program) {
|
|
|
7270
8246
|
servers.action(async (_options, command) => {
|
|
7271
8247
|
const globalOptions = getGlobalOptions(command);
|
|
7272
8248
|
const platformOptions = platformOptionsOf(command);
|
|
7273
|
-
const result = await
|
|
8249
|
+
const result = await runPlatformCommand10(
|
|
7274
8250
|
platformOptions,
|
|
7275
8251
|
globalOptions.timeout,
|
|
7276
8252
|
({ client, signal }) => listProjectServersOperation.execute(
|
|
@@ -7292,13 +8268,13 @@ function registerProjectsCommands(program) {
|
|
|
7292
8268
|
}
|
|
7293
8269
|
return parsed;
|
|
7294
8270
|
};
|
|
7295
|
-
|
|
8271
|
+
addPlatformOptions10(
|
|
7296
8272
|
servers.command("create").alias("add").description("Create a saved MCP server").option("--project <id-or-name>", "Project name or ID").requiredOption("--body <json>", "Server JSON body")
|
|
7297
8273
|
).action(async (options, command) => {
|
|
7298
8274
|
const globalOptions = getGlobalOptions(command);
|
|
7299
8275
|
const platformOptions = platformOptionsOf(command);
|
|
7300
8276
|
const project = requireProject(command, platformOptions);
|
|
7301
|
-
const result = await
|
|
8277
|
+
const result = await runPlatformCommand10(
|
|
7302
8278
|
platformOptions,
|
|
7303
8279
|
globalOptions.timeout,
|
|
7304
8280
|
({ client, signal }) => createProjectServerOperation.execute(
|
|
@@ -7308,13 +8284,13 @@ function registerProjectsCommands(program) {
|
|
|
7308
8284
|
);
|
|
7309
8285
|
writeResult(result, globalOptions.format);
|
|
7310
8286
|
});
|
|
7311
|
-
|
|
8287
|
+
addPlatformOptions10(
|
|
7312
8288
|
servers.command("get").description("Get one saved MCP server").option("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID")
|
|
7313
8289
|
).action(async (options, command) => {
|
|
7314
8290
|
const globalOptions = getGlobalOptions(command);
|
|
7315
8291
|
const platformOptions = platformOptionsOf(command);
|
|
7316
8292
|
const project = requireProject(command, platformOptions);
|
|
7317
|
-
const result = await
|
|
8293
|
+
const result = await runPlatformCommand10(
|
|
7318
8294
|
platformOptions,
|
|
7319
8295
|
globalOptions.timeout,
|
|
7320
8296
|
({ client, signal }) => getProjectServerOperation.execute(
|
|
@@ -7324,14 +8300,14 @@ function registerProjectsCommands(program) {
|
|
|
7324
8300
|
);
|
|
7325
8301
|
writeResult(result, globalOptions.format);
|
|
7326
8302
|
});
|
|
7327
|
-
|
|
8303
|
+
addPlatformOptions10(
|
|
7328
8304
|
servers.command("update").description("Update one saved MCP server").option("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID").requiredOption("--body <json>", "Patch JSON body")
|
|
7329
8305
|
).action(
|
|
7330
8306
|
async (options, command) => {
|
|
7331
8307
|
const globalOptions = getGlobalOptions(command);
|
|
7332
8308
|
const platformOptions = platformOptionsOf(command);
|
|
7333
8309
|
const project = requireProject(command, platformOptions);
|
|
7334
|
-
const result = await
|
|
8310
|
+
const result = await runPlatformCommand10(
|
|
7335
8311
|
platformOptions,
|
|
7336
8312
|
globalOptions.timeout,
|
|
7337
8313
|
({ client, signal }) => updateProjectServerOperation.execute(
|
|
@@ -7346,13 +8322,13 @@ function registerProjectsCommands(program) {
|
|
|
7346
8322
|
writeResult(result, globalOptions.format);
|
|
7347
8323
|
}
|
|
7348
8324
|
);
|
|
7349
|
-
|
|
8325
|
+
addPlatformOptions10(
|
|
7350
8326
|
servers.command("delete").alias("remove").description("Delete one saved MCP server").option("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID")
|
|
7351
8327
|
).action(async (options, command) => {
|
|
7352
8328
|
const globalOptions = getGlobalOptions(command);
|
|
7353
8329
|
const platformOptions = platformOptionsOf(command);
|
|
7354
8330
|
const project = requireProject(command, platformOptions);
|
|
7355
|
-
const result = await
|
|
8331
|
+
const result = await runPlatformCommand10(
|
|
7356
8332
|
platformOptions,
|
|
7357
8333
|
globalOptions.timeout,
|
|
7358
8334
|
({ client, signal }) => deleteProjectServerOperation.execute(
|
|
@@ -7362,7 +8338,7 @@ function registerProjectsCommands(program) {
|
|
|
7362
8338
|
);
|
|
7363
8339
|
writeResult(result, globalOptions.format);
|
|
7364
8340
|
});
|
|
7365
|
-
|
|
8341
|
+
addPlatformOptions10(
|
|
7366
8342
|
servers.command("connect").description(
|
|
7367
8343
|
"Connect an MCP server URL to a project, authorizing in a browser if needed"
|
|
7368
8344
|
).requiredOption("--url <url>", "MCP server URL to connect").option("--project <id-or-name>", "Project name or ID").option(
|
|
@@ -7384,7 +8360,7 @@ function registerProjectsCommands(program) {
|
|
|
7384
8360
|
name: options.name,
|
|
7385
8361
|
reauthorize: options.reauthorize
|
|
7386
8362
|
});
|
|
7387
|
-
const created = await
|
|
8363
|
+
const created = await runPlatformCommand10(
|
|
7388
8364
|
platformOptions,
|
|
7389
8365
|
globalOptions.timeout,
|
|
7390
8366
|
({ client, signal }) => connectProjectServerOperation.execute(input, { client, signal })
|
|
@@ -7432,7 +8408,7 @@ function registerProjectsCommands(program) {
|
|
|
7432
8408
|
}
|
|
7433
8409
|
}
|
|
7434
8410
|
);
|
|
7435
|
-
|
|
8411
|
+
addPlatformOptions10(
|
|
7436
8412
|
servers.command("connect-status").description("Check a connection request started by `server connect`").requiredOption("--request <id>", "Connection request id (scr_\u2026)")
|
|
7437
8413
|
).action(
|
|
7438
8414
|
async (options, command) => {
|
|
@@ -7440,7 +8416,7 @@ function registerProjectsCommands(program) {
|
|
|
7440
8416
|
const input = getProjectServerConnectionStatusOperation.inputSchema.parse({
|
|
7441
8417
|
connectionRequestId: options.request
|
|
7442
8418
|
});
|
|
7443
|
-
const payload = await
|
|
8419
|
+
const payload = await runPlatformCommand10(
|
|
7444
8420
|
platformOptionsOf(command),
|
|
7445
8421
|
globalOptions.timeout,
|
|
7446
8422
|
({ client, signal }) => getProjectServerConnectionStatusOperation.execute(input, {
|
|
@@ -7451,7 +8427,7 @@ function registerProjectsCommands(program) {
|
|
|
7451
8427
|
writeResult(payload, globalOptions.format);
|
|
7452
8428
|
}
|
|
7453
8429
|
);
|
|
7454
|
-
|
|
8430
|
+
addPlatformOptions10(
|
|
7455
8431
|
projects.command("status").description(
|
|
7456
8432
|
"Health-check every server in a project (hosted doctor per server)"
|
|
7457
8433
|
).option(
|
|
@@ -7461,7 +8437,7 @@ function registerProjectsCommands(program) {
|
|
|
7461
8437
|
).action(async (_options, command) => {
|
|
7462
8438
|
const globalOptions = getGlobalOptions(command);
|
|
7463
8439
|
const platformOptions = platformOptionsOf(command);
|
|
7464
|
-
const payload = await
|
|
8440
|
+
const payload = await runPlatformCommand10(
|
|
7465
8441
|
platformOptions,
|
|
7466
8442
|
globalOptions.timeout,
|
|
7467
8443
|
({ client, signal }) => showServersOperation.execute(
|
|
@@ -7508,7 +8484,7 @@ async function pollConnection(options, timeoutMs, connectionRequestId, expiresAt
|
|
|
7508
8484
|
for (; ; ) {
|
|
7509
8485
|
let current;
|
|
7510
8486
|
try {
|
|
7511
|
-
current = await
|
|
8487
|
+
current = await runPlatformCommand10(
|
|
7512
8488
|
options,
|
|
7513
8489
|
timeoutMs,
|
|
7514
8490
|
({ client, signal }) => getProjectServerConnectionStatusOperation.execute(
|
|
@@ -13285,13 +14261,16 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
13285
14261
|
registerXaaCommands(program);
|
|
13286
14262
|
registerProtocolCommands(program);
|
|
13287
14263
|
registerAuthCommands(program);
|
|
14264
|
+
registerOrganizationsCommands(program);
|
|
13288
14265
|
registerProjectsCommands(program);
|
|
13289
14266
|
registerEvalCommands(program);
|
|
13290
14267
|
registerChatCommands(program);
|
|
13291
14268
|
registerHostsCommands(program);
|
|
13292
14269
|
registerEnvironmentsCommands(program);
|
|
13293
|
-
registerJourneysCommands(program);
|
|
14270
|
+
const journeys = registerJourneysCommands(program);
|
|
13294
14271
|
registerScenariosCommands(program);
|
|
14272
|
+
registerSwarmAuthoringCommands(program, journeys);
|
|
14273
|
+
registerUserTestingCommands(program);
|
|
13295
14274
|
registerImagesCommands(program);
|
|
13296
14275
|
registerTunnelCommands(program);
|
|
13297
14276
|
registerInspectorCommands(program);
|