@mcpjam/cli 6.2.2 → 6.3.1
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 +1 -1
- package/dist/index.js +1726 -250
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { Command, CommanderError, Option } from 'commander';
|
|
3
3
|
import { realpathSync, readFileSync, existsSync, mkdirSync, writeFileSync, statSync, chmodSync, unlinkSync, closeSync, renameSync, lstatSync, openSync } from 'fs';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import { MODEL_REASONING_EFFORTS, MCP_CHECK_IDS, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_IDS, RETIRED_MCP_CHECK_IDS, RENAMED_MCP_TASKS_CHECK_IDS, loadEvalSuiteFile, createSuiteFileRunner, runSuiteFile, SuiteFileRunError, formatLocalEvalRunSummary, renderStructuredRunJson, probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listServerSkillCatalog, getVerifiedServerSkill, isServerSkillRefusalError, readVerifiedServerSkillFile, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, OPENAI_SUBMISSION_MODES, renderStructuredRunJUnitXml, renderStructuredRunHtml, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, parseToolResultAuthChallenge, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, MCP_TASKS_READINESS_IDS, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_LOG_LEVELS, MCP_PROTOCOL_VERSIONS, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, DIRECTORY_FEATURE_CLAIMS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, gatherMuseReadinessEvidence, gradeMuseReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, withSkillsExtensionCapability, extractAuthChallenge, isUnauthorized401, detectCiMetadata, MCP_SKILLS_EXTENSION_ID, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_TASKS_CHECK_CATEGORIES, validateTaskOverrides, EVENTS_CHECK_IDS, MCP_OAUTH_READINESS_IDS, OAuthProxyError, isLoopbackHost, MCP_READINESS_IDS, LAZY_AUTH_PROBE_LIMITS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, declareEvalSuiteFileValidity, aiRefusalClass, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, startEventsConformanceReceiver, runEventsConformance, MCP_CHECK_CATEGORIES, recognizedAiRefusalCode, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, suiteFilePointer, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, planPlatformSuiteGradingUpdate, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES, isMCPEventsWireError, classifyEventsRpcError } from '@mcpjam/sdk';
|
|
5
|
+
import { MODEL_REASONING_EFFORTS, MCP_CHECK_IDS, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_IDS, RETIRED_MCP_CHECK_IDS, RENAMED_MCP_TASKS_CHECK_IDS, loadEvalSuiteFile, createSuiteFileRunner, runSuiteFile, SuiteFileRunError, formatLocalEvalRunSummary, renderStructuredRunJson, probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listServerSkillCatalog, getVerifiedServerSkill, isServerSkillRefusalError, readVerifiedServerSkillFile, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, OPENAI_SUBMISSION_MODES, renderStructuredRunJUnitXml, renderStructuredRunHtml, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, parseToolResultAuthChallenge, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, MCP_TASKS_READINESS_IDS, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_LOG_LEVELS, MCP_PROTOCOL_VERSIONS, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, DIRECTORY_FEATURE_CLAIMS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, gatherMuseReadinessEvidence, gradeMuseReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, withSkillsExtensionCapability, extractAuthChallenge, isUnauthorized401, detectCiMetadata, MCP_SKILLS_EXTENSION_ID, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_TASKS_CHECK_CATEGORIES, validateTaskOverrides, EVENTS_CHECK_IDS, MCP_OAUTH_READINESS_IDS, OAuthProxyError, isLoopbackHost, MCP_READINESS_IDS, LAZY_AUTH_PROBE_LIMITS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, DIRECTORY_SNAPSHOT_LABELS, DIRECTORY_TOOL_TEST_STATUSES, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, declareEvalSuiteFileValidity, aiRefusalClass, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, startEventsConformanceReceiver, runEventsConformance, MCP_CHECK_CATEGORIES, recognizedAiRefusalCode, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, suiteFilePointer, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, planPlatformSuiteGradingUpdate, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES, isMCPEventsWireError, classifyEventsRpcError } from '@mcpjam/sdk';
|
|
6
6
|
import { isMcpjamDeploymentError, deploymentPolicy, resolveDeployment, MCPJAM_CLOUD_API_URL, backendFetch, trimTrailingSlashes } from '@mcpjam/sdk/internal/deployment';
|
|
7
|
-
import { RUN_LAUNCH_HEADERS, getRegistryDirectoryServerOperation, isPlatformApiError, resolveProject, listOrganizationsOperation, listProjectsOperation, createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, cancelProjectServerConnectionOperation, listChatSessionsOperation, sendChatMessageOperation, createTunnelOperation, listEvalSuiteRunsOperation, listEvalSuiteRevisionsOperation, runEvalSuiteOperation, getEvalRunOperation, getEvalRunRouteFactsOperation, getEvalRunServerFactsOperation, proposeEvalDescriptionRewriteOperation, startEvalDescriptionExperimentOperation, getEvalDescriptionExperimentOperation, cancelEvalRunOperation, backtestEvalRunJudgeOperation, backtestEvalRunOperation, requestEvalRunJudgeOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, importEvalCasesOperation, createClientOperation, updateClientOperation, setClientServersOperation, duplicateClientOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createSecretOperation, updateSecretOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, listTraceDestinationsOperation, getTraceDestinationOperation, createTraceDestinationOperation, updateTraceDestinationOperation, deleteTraceDestinationOperation, testTraceDestinationOperation, pauseTraceDestinationOperation, resumeTraceDestinationOperation, backfillTraceDestinationOperation, listTraceDestinationBackfillsOperation, runOperationWithPermalinks, withPermalinkEnvelope, PlatformApiError, installRegistryServerOperation, installRegistryDirectoryServerOperation, getProjectServerOperation, PlatformApiClient, projectResolutionError, listProjectServersOperation, createProjectServerOperation, listServerRevisionsOperation, getServerRevisionOperation, diffServerRevisionsOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, driveChatSessionBrowserOperation, observeChatSessionBrowserOperation, describePlatformRefusal, platformRefusalHint, createEvalSuiteOperation, listEvalSuitesOperation, buildAppPermalink, listEvalSuiteStageAnalyticsOperation, getEvalRunStageAnalyticsOperation, listEvalGithubReposOperation, connectEvalGithubRepoOperation, resolveEnvironmentOperation, listClientsOperation, getClientOperation, deleteClientOperation, listEnvironmentsOperation, getEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listSecretsOperation, getSecretOperation, deleteSecretOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, listProjectSkillsOperation, getProjectSkillOperation, listGoalsOperation, listGoalRunsOperation, getGoalRunOperation, launchGoalRunOperation, cancelGoalRunOperation, listGoalRunSessionsOperation, platformBrowserToolPolicySchema, listServerToolsOperation, runEvalCaseOperation, sendFeedbackOperation, startConformanceRunOperation, listConformanceRunsOperation, getConformanceRunOperation, getConformanceReportOperation, getConformanceCheckOperation, getCapabilitiesOperation, getStudyOperation, listStudySessionsOperation, getStudySessionOperation, getStudyMetricsOperation, getStudyUsageOperation, listStudyFindingsOperation, getStudySignalsOperation, getStudyInsightsOperation, requestStudyInsightsOperation, cancelStudyInsightsOperation, dismissStudyFindingOperation, undismissStudyFindingOperation, updateStudyOperation, setStudyGuestExecutionOperation, rotateStudyLinkOperation, upsertStudyMemberOperation, removeStudyMemberOperation, rebindStudyOperation, listStudiesOperation, publishStudyOperation, unpublishStudyOperation, listServerAccountsOperation, getServerAccountOperation, uploadServerAccountTokensOperation, updateServerAccountOperation, deleteServerAccountOperation, searchSessionsOperation, getChatSessionOperation, getChatSessionTraceOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getGoalOperation, createGoalOperation, updateGoalOperation, archiveGoalOperation, generateGoalsOperation, getSwarmOverviewOperation, getGoalRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getSwarmRunInsightsOperation, requestSwarmRunInsightsOperation, cancelSwarmRunInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, getReadinessReportOperation, listRegistryDirectorySourcesOperation, searchRegistryDirectoryOperation, listRegistryServersOperation, listRegistryConnectionsOperation, uninstallRegistryServerOperation } from '@mcpjam/sdk/platform';
|
|
7
|
+
import { RUN_LAUNCH_HEADERS, getRegistryDirectoryServerOperation, isPlatformApiError, resolveProject, listOrganizationsOperation, listProjectsOperation, createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, cancelProjectServerConnectionOperation, listChatSessionsOperation, sendChatMessageOperation, createTunnelOperation, listEvalSuiteRunsOperation, listEvalSuiteRevisionsOperation, runEvalSuiteOperation, getEvalRunOperation, getEvalRunRouteFactsOperation, getEvalRunServerFactsOperation, proposeEvalDescriptionRewriteOperation, startEvalDescriptionExperimentOperation, getEvalDescriptionExperimentOperation, cancelEvalRunOperation, backtestEvalRunJudgeOperation, backtestEvalRunOperation, requestEvalRunJudgeOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, importEvalCasesOperation, createClientOperation, updateClientOperation, setClientServersOperation, duplicateClientOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createSecretOperation, updateSecretOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, listTraceDestinationsOperation, getTraceDestinationOperation, createTraceDestinationOperation, updateTraceDestinationOperation, deleteTraceDestinationOperation, testTraceDestinationOperation, pauseTraceDestinationOperation, resumeTraceDestinationOperation, backfillTraceDestinationOperation, listTraceDestinationBackfillsOperation, runOperationWithPermalinks, withPermalinkEnvelope, PlatformApiError, installRegistryServerOperation, installRegistryDirectoryServerOperation, getProjectServerOperation, PlatformApiClient, startDirectorySubmissionRunOperation, getDirectorySubmissionResultsOperation, updateDirectorySubmissionOperation, getDirectorySubmissionFindingOperation, listDirectorySubmissionEventsOperation, getDirectorySubmissionTestPlanOperation, draftDirectorySubmissionTestPlanOperation, saveDirectorySubmissionTestPlanOperation, getDirectorySubmissionToolTestsOperation, getDirectorySubmissionEvalsOperation, setDirectorySubmissionEvalsOperation, importDirectorySubmissionTestCasesOperation, exportDirectorySubmissionTestCasesOperation, projectResolutionError, listProjectServersOperation, createProjectServerOperation, listServerRevisionsOperation, getServerRevisionOperation, diffServerRevisionsOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, driveChatSessionBrowserOperation, observeChatSessionBrowserOperation, describePlatformRefusal, platformRefusalHint, createEvalSuiteOperation, listEvalSuitesOperation, buildAppPermalink, listEvalSuiteStageAnalyticsOperation, getEvalRunStageAnalyticsOperation, listEvalGithubReposOperation, connectEvalGithubRepoOperation, resolveEnvironmentOperation, listClientsOperation, getClientOperation, deleteClientOperation, listEnvironmentsOperation, getEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listSecretsOperation, getSecretOperation, deleteSecretOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, listProjectSkillsOperation, getProjectSkillOperation, listGoalsOperation, listGoalRunsOperation, getGoalRunOperation, launchGoalRunOperation, cancelGoalRunOperation, listGoalRunSessionsOperation, getDirectorySubmissionOperation, directorySubmissionConflict, getDirectorySubmissionHandoffOperation, listDirectorySubmissionFindingsOperation, exportDirectorySubmissionOperation, directoryTestPlanSchema, platformBrowserToolPolicySchema, listServerToolsOperation, runEvalCaseOperation, sendFeedbackOperation, startConformanceRunOperation, listConformanceRunsOperation, getConformanceRunOperation, getConformanceReportOperation, getConformanceCheckOperation, getCapabilitiesOperation, getStudyOperation, listStudySessionsOperation, getStudySessionOperation, getStudyMetricsOperation, getStudyUsageOperation, listStudyFindingsOperation, getStudySignalsOperation, getStudyInsightsOperation, requestStudyInsightsOperation, cancelStudyInsightsOperation, dismissStudyFindingOperation, undismissStudyFindingOperation, updateStudyOperation, setStudyGuestExecutionOperation, rotateStudyLinkOperation, upsertStudyMemberOperation, removeStudyMemberOperation, rebindStudyOperation, listStudiesOperation, publishStudyOperation, unpublishStudyOperation, listServerAccountsOperation, getServerAccountOperation, uploadServerAccountTokensOperation, updateServerAccountOperation, deleteServerAccountOperation, searchSessionsOperation, getChatSessionOperation, getChatSessionTraceOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getGoalOperation, createGoalOperation, updateGoalOperation, archiveGoalOperation, generateGoalsOperation, getSwarmOverviewOperation, getGoalRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getSwarmRunInsightsOperation, requestSwarmRunInsightsOperation, cancelSwarmRunInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, recordDirectorySubmissionStatusOperation, recordDirectorySubmissionSnapshotOperation, importDirectoryFindingOperation, getDirectoryFlowOperation, listDirectoryFlowsOperation, createDirectorySubmissionOperation, listDirectorySubmissionsOperation, deleteDirectorySubmissionOperation, createReviewerAttemptOperation, getReviewerAttemptOperation, listReviewerAttemptsOperation, resumeReviewerAttemptOperation, createReviewerHandoffOperation, cancelReviewerAttemptOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, resumeReadinessRunOperation, getReadinessReportOperation, listRegistryDirectorySourcesOperation, searchRegistryDirectoryOperation, listRegistryServersOperation, listRegistryConnectionsOperation, uninstallRegistryServerOperation } from '@mcpjam/sdk/platform';
|
|
8
8
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
9
9
|
import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink, stat } from 'fs/promises';
|
|
10
10
|
import path3, { join, dirname, basename, resolve } from 'path';
|
|
@@ -34,7 +34,90 @@ import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/
|
|
|
34
34
|
|
|
35
35
|
// package.json
|
|
36
36
|
var package_default = {
|
|
37
|
-
version: "6.
|
|
37
|
+
version: "6.3.1"};
|
|
38
|
+
|
|
39
|
+
// src/lib/command-outcome.ts
|
|
40
|
+
var UNKNOWN_COMMAND = "(unknown)";
|
|
41
|
+
var recorded;
|
|
42
|
+
function recordCommandOutcome(outcome, errorCode) {
|
|
43
|
+
if (recorded?.outcome === "interrupted") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
recorded = errorCode === void 0 ? { outcome } : { outcome, errorCode };
|
|
47
|
+
}
|
|
48
|
+
function resetCommandOutcome() {
|
|
49
|
+
recorded = void 0;
|
|
50
|
+
}
|
|
51
|
+
function resolveCommandOutcome(exitCode, thrownErrorCode) {
|
|
52
|
+
if (recorded?.outcome === "interrupted") {
|
|
53
|
+
return { outcome: "interrupted" };
|
|
54
|
+
}
|
|
55
|
+
if (thrownErrorCode !== void 0) {
|
|
56
|
+
return {
|
|
57
|
+
outcome: thrownErrorCode === "USAGE_ERROR" ? "usage_error" : "error",
|
|
58
|
+
errorCode: thrownErrorCode
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (exitCode === 0) {
|
|
62
|
+
return { outcome: "ok" };
|
|
63
|
+
}
|
|
64
|
+
if (recorded?.outcome === "check_failed") {
|
|
65
|
+
return { outcome: "check_failed" };
|
|
66
|
+
}
|
|
67
|
+
const errorCode = recorded?.errorCode ?? "UNKNOWN_ERROR";
|
|
68
|
+
return {
|
|
69
|
+
outcome: errorCode === "USAGE_ERROR" ? "usage_error" : "error",
|
|
70
|
+
errorCode
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function resolveRegisteredCommandPath(program, argv) {
|
|
74
|
+
const path14 = [];
|
|
75
|
+
let current = program;
|
|
76
|
+
const tokens = argv.slice(2);
|
|
77
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
78
|
+
const token = tokens[index];
|
|
79
|
+
if (token === "--") {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
if (token.startsWith("-")) {
|
|
83
|
+
const next2 = tokens[index + 1];
|
|
84
|
+
const value = separateOptionValue(current, token);
|
|
85
|
+
if (next2 !== void 0 && (value === "required" || value === "optional" && !next2.startsWith("-"))) {
|
|
86
|
+
index += 1;
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const next = current.commands.find(
|
|
91
|
+
(command) => command.name() === token || command.aliases().includes(token)
|
|
92
|
+
);
|
|
93
|
+
if (!next) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
path14.push(next.name());
|
|
97
|
+
current = next;
|
|
98
|
+
}
|
|
99
|
+
return path14;
|
|
100
|
+
}
|
|
101
|
+
function separateOptionValue(command, token) {
|
|
102
|
+
if (token.includes("=") || /^-[^-]./.test(token)) {
|
|
103
|
+
return "none";
|
|
104
|
+
}
|
|
105
|
+
for (let cursor = command; cursor; cursor = cursor.parent) {
|
|
106
|
+
const option = cursor.options.find(
|
|
107
|
+
(candidate) => candidate.long === token || candidate.short === token
|
|
108
|
+
);
|
|
109
|
+
if (option) {
|
|
110
|
+
return option.required ? "required" : option.optional ? "optional" : "none";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return "none";
|
|
114
|
+
}
|
|
115
|
+
function argvOptsOutOfTelemetry(argv) {
|
|
116
|
+
const end = argv.indexOf("--");
|
|
117
|
+
return (end === -1 ? argv : argv.slice(0, end)).includes("--no-telemetry");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/lib/output.ts
|
|
38
121
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
39
122
|
var CliError = class extends Error {
|
|
40
123
|
code;
|
|
@@ -234,6 +317,9 @@ function parseLooseOutputFormat(value) {
|
|
|
234
317
|
}
|
|
235
318
|
function setProcessExitCode(code) {
|
|
236
319
|
process.exitCode = code;
|
|
320
|
+
if (code !== 0) {
|
|
321
|
+
recordCommandOutcome("check_failed");
|
|
322
|
+
}
|
|
237
323
|
}
|
|
238
324
|
|
|
239
325
|
// src/lib/credentials-file.ts
|
|
@@ -454,7 +540,7 @@ function isAccessTokenUsable(contents, now) {
|
|
|
454
540
|
}
|
|
455
541
|
return Date.parse(contents.expiresAt) - now.getTime() > ACCESS_TOKEN_EXPIRY_SKEW_MS;
|
|
456
542
|
}
|
|
457
|
-
var readTextFile = (
|
|
543
|
+
var readTextFile = (path14, encoding) => readFileSync(path14, encoding);
|
|
458
544
|
var JsonInputContext = class {
|
|
459
545
|
constructor(readFile4 = readTextFile) {
|
|
460
546
|
this.readFile = readFile4;
|
|
@@ -1409,7 +1495,7 @@ function toCliError(error, context = {}) {
|
|
|
1409
1495
|
function requestsUpload(options) {
|
|
1410
1496
|
return options.upload === true || options.requireUpload === true;
|
|
1411
1497
|
}
|
|
1412
|
-
async function uploadConformanceReport(
|
|
1498
|
+
async function uploadConformanceReport(report2, args) {
|
|
1413
1499
|
const env = process.env;
|
|
1414
1500
|
const { baseUrl } = resolveCliDeployment({ credential: "api-key" }, { env });
|
|
1415
1501
|
const headers = resolvePlatformExtraHeaders({}, env);
|
|
@@ -1422,7 +1508,7 @@ async function uploadConformanceReport(report, args) {
|
|
|
1422
1508
|
...headers ? { headers } : {}
|
|
1423
1509
|
};
|
|
1424
1510
|
try {
|
|
1425
|
-
const uploaded = args.requireUpload ? await reportConformanceRun(
|
|
1511
|
+
const uploaded = args.requireUpload ? await reportConformanceRun(report2, options) : await reportConformanceRunSafely(report2, options);
|
|
1426
1512
|
if (uploaded?.runUrl && !args.command.optsWithGlobals().quiet) {
|
|
1427
1513
|
process.stderr.write(`Uploaded: ${uploaded.runUrl}
|
|
1428
1514
|
`);
|
|
@@ -1440,12 +1526,12 @@ async function uploadConformanceReport(report, args) {
|
|
|
1440
1526
|
async function maybeUploadSingleSuite(args) {
|
|
1441
1527
|
if (!requestsUpload(args)) return;
|
|
1442
1528
|
const suiteReport = args.report ?? toConformanceReport(args.result);
|
|
1443
|
-
const
|
|
1529
|
+
const report2 = buildConformanceRunReport({
|
|
1444
1530
|
requestedSuites: [args.suiteKind],
|
|
1445
1531
|
reports: { [args.suiteKind]: suiteReport },
|
|
1446
1532
|
startedAt: Date.now() - (suiteReport.durationMs ?? 0)
|
|
1447
1533
|
});
|
|
1448
|
-
await uploadConformanceReport(
|
|
1534
|
+
await uploadConformanceReport(report2, args);
|
|
1449
1535
|
}
|
|
1450
1536
|
async function writeFileAtomic(destinationPath, body, options = {}) {
|
|
1451
1537
|
const resolved = path3.resolve(process.cwd(), destinationPath);
|
|
@@ -2619,12 +2705,12 @@ function renderConformanceResult(result, format) {
|
|
|
2619
2705
|
}
|
|
2620
2706
|
}
|
|
2621
2707
|
function renderConformanceReporterResult(result, reporter) {
|
|
2622
|
-
const
|
|
2708
|
+
const report2 = toConformanceReport(result);
|
|
2623
2709
|
switch (reporter) {
|
|
2624
2710
|
case "json-summary":
|
|
2625
|
-
return JSON.stringify(renderConformanceReportJson(
|
|
2711
|
+
return JSON.stringify(renderConformanceReportJson(report2));
|
|
2626
2712
|
case "junit-xml":
|
|
2627
|
-
return renderConformanceReportJUnitXml(
|
|
2713
|
+
return renderConformanceReportJUnitXml(report2);
|
|
2628
2714
|
case "html":
|
|
2629
2715
|
throw usageError(
|
|
2630
2716
|
'The "html" reporter is not available for this command yet. Use "json-summary" or "junit-xml".'
|
|
@@ -2934,8 +3020,11 @@ var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
|
2934
3020
|
var TELEMETRY_STATE_FILE = "telemetry.json";
|
|
2935
3021
|
var TELEMETRY_EVENT_NAME = "cli_command";
|
|
2936
3022
|
var CONFORMANCE_EVENT_NAME = "conformance_run_triggered";
|
|
3023
|
+
var MCP_TOOL_EVENT_NAME = "cli_mcp_tool_called";
|
|
2937
3024
|
var TELEMETRY_STATE_VERSION = 1;
|
|
2938
3025
|
var DEFAULT_FLUSH_TIMEOUT_MS = 3e3;
|
|
3026
|
+
var FORCED_EXIT_FLUSH_TIMEOUT_MS = 1e3;
|
|
3027
|
+
var INTERRUPTED_EXIT_CODE = 130;
|
|
2939
3028
|
var SAFE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
2940
3029
|
"USAGE_ERROR",
|
|
2941
3030
|
"TIMEOUT",
|
|
@@ -3004,6 +3093,9 @@ function initTelemetry(program, cliVersion, options = {}) {
|
|
|
3004
3093
|
const run = {
|
|
3005
3094
|
cliVersion,
|
|
3006
3095
|
options,
|
|
3096
|
+
program,
|
|
3097
|
+
initializedAtMs: Date.now(),
|
|
3098
|
+
forcedExitStarted: false,
|
|
3007
3099
|
commandOptOut: false,
|
|
3008
3100
|
shouldCapture: false,
|
|
3009
3101
|
captured: false,
|
|
@@ -3025,22 +3117,19 @@ function initTelemetry(program, cliVersion, options = {}) {
|
|
|
3025
3117
|
run.conformanceCaptured = false;
|
|
3026
3118
|
});
|
|
3027
3119
|
return {
|
|
3028
|
-
|
|
3029
|
-
const client = run.client;
|
|
3030
|
-
if (!client) {
|
|
3031
|
-
return;
|
|
3032
|
-
}
|
|
3033
|
-
try {
|
|
3034
|
-
const timeoutMs = options.flushTimeoutMs ?? DEFAULT_FLUSH_TIMEOUT_MS;
|
|
3035
|
-
await withTimeout(
|
|
3036
|
-
flushClient(run, client, timeoutMs),
|
|
3037
|
-
timeoutMs
|
|
3038
|
-
);
|
|
3039
|
-
} catch {
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3120
|
+
flush: () => flushRun(run, options.flushTimeoutMs ?? DEFAULT_FLUSH_TIMEOUT_MS)
|
|
3042
3121
|
};
|
|
3043
3122
|
}
|
|
3123
|
+
async function flushRun(run, timeoutMs) {
|
|
3124
|
+
const client = run.client;
|
|
3125
|
+
if (!client) {
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3128
|
+
try {
|
|
3129
|
+
await withTimeout(flushClient(run, client, timeoutMs), timeoutMs);
|
|
3130
|
+
} catch {
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3044
3133
|
async function flushClient(run, client, timeoutMs) {
|
|
3045
3134
|
const pendingCaptures = run.pendingCaptures.splice(0);
|
|
3046
3135
|
if (pendingCaptures.length > 0) {
|
|
@@ -3048,7 +3137,7 @@ async function flushClient(run, client, timeoutMs) {
|
|
|
3048
3137
|
}
|
|
3049
3138
|
await client.flush(timeoutMs);
|
|
3050
3139
|
}
|
|
3051
|
-
function captureCommandEvent(exitCode, errorCode) {
|
|
3140
|
+
function captureCommandEvent(exitCode, outcome, errorCode) {
|
|
3052
3141
|
const run = activeRun;
|
|
3053
3142
|
if (!run || !run.shouldCapture || run.captured || !run.startedAtMs || !run.command) {
|
|
3054
3143
|
return;
|
|
@@ -3069,6 +3158,7 @@ function captureCommandEvent(exitCode, errorCode) {
|
|
|
3069
3158
|
command: run.command,
|
|
3070
3159
|
success: exitCode === 0,
|
|
3071
3160
|
exit_code: exitCode,
|
|
3161
|
+
outcome,
|
|
3072
3162
|
duration_ms: Math.max(0, Date.now() - run.startedAtMs),
|
|
3073
3163
|
cli_version: run.cliVersion,
|
|
3074
3164
|
os: process.platform,
|
|
@@ -3082,7 +3172,7 @@ function captureCommandEvent(exitCode, errorCode) {
|
|
|
3082
3172
|
if (run.transport) {
|
|
3083
3173
|
properties.transport = run.transport;
|
|
3084
3174
|
}
|
|
3085
|
-
const safeErrorCode =
|
|
3175
|
+
const safeErrorCode = outcome === "error" || outcome === "usage_error" ? normalizeTelemetryErrorCode(errorCode) : void 0;
|
|
3086
3176
|
if (safeErrorCode) {
|
|
3087
3177
|
properties.error_code = safeErrorCode;
|
|
3088
3178
|
}
|
|
@@ -3090,7 +3180,33 @@ function captureCommandEvent(exitCode, errorCode) {
|
|
|
3090
3180
|
} catch {
|
|
3091
3181
|
}
|
|
3092
3182
|
}
|
|
3093
|
-
function
|
|
3183
|
+
function captureUsageErrorEvent(argv, exitCode = 2) {
|
|
3184
|
+
const run = activeRun;
|
|
3185
|
+
if (!run || run.captured) {
|
|
3186
|
+
return;
|
|
3187
|
+
}
|
|
3188
|
+
if (!run.command) {
|
|
3189
|
+
const commandPath = resolveRegisteredCommandPath(run.program, argv);
|
|
3190
|
+
run.command = commandPath.length > 0 ? commandPath.join(" ") : UNKNOWN_COMMAND;
|
|
3191
|
+
run.commandOptOut = argvOptsOutOfTelemetry(argv);
|
|
3192
|
+
run.startedAtMs = run.initializedAtMs;
|
|
3193
|
+
run.shouldCapture = commandPath[0] !== "telemetry";
|
|
3194
|
+
}
|
|
3195
|
+
captureCommandEvent(exitCode, "usage_error", "USAGE_ERROR");
|
|
3196
|
+
}
|
|
3197
|
+
async function exitInterrupted(exit = (code) => process.exit(code)) {
|
|
3198
|
+
const run = activeRun;
|
|
3199
|
+
if (!run || run.forcedExitStarted) {
|
|
3200
|
+
exit(INTERRUPTED_EXIT_CODE);
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
run.forcedExitStarted = true;
|
|
3204
|
+
recordCommandOutcome("interrupted");
|
|
3205
|
+
captureCommandEvent(INTERRUPTED_EXIT_CODE, "interrupted");
|
|
3206
|
+
await flushRun(run, FORCED_EXIT_FLUSH_TIMEOUT_MS);
|
|
3207
|
+
exit(INTERRUPTED_EXIT_CODE);
|
|
3208
|
+
}
|
|
3209
|
+
function captureConformanceRunEvent(suite, mode) {
|
|
3094
3210
|
const run = activeRun;
|
|
3095
3211
|
if (!run || !run.shouldCapture || run.conformanceCaptured || !run.command) {
|
|
3096
3212
|
return;
|
|
@@ -3109,7 +3225,39 @@ function captureConformanceRunEvent() {
|
|
|
3109
3225
|
decision,
|
|
3110
3226
|
resolveInstallId(run, decision.state),
|
|
3111
3227
|
CONFORMANCE_EVENT_NAME,
|
|
3112
|
-
{ run_source: "cli" }
|
|
3228
|
+
{ run_source: "cli", suite, mode, cli_version: run.cliVersion }
|
|
3229
|
+
);
|
|
3230
|
+
} catch {
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
function captureMcpToolEvent(call) {
|
|
3234
|
+
const run = activeRun;
|
|
3235
|
+
if (!run || !run.shouldCapture || !run.command) {
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
try {
|
|
3239
|
+
const decision = resolveTelemetryDecision({
|
|
3240
|
+
...run.options,
|
|
3241
|
+
commandOptOut: run.commandOptOut
|
|
3242
|
+
});
|
|
3243
|
+
if (!decision.enabled) {
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
const properties = {
|
|
3247
|
+
tool: call.tool,
|
|
3248
|
+
success: call.success,
|
|
3249
|
+
duration_ms: Math.max(0, Math.round(call.durationMs)),
|
|
3250
|
+
cli_version: run.cliVersion
|
|
3251
|
+
};
|
|
3252
|
+
if (!call.success) {
|
|
3253
|
+
properties.error_code = normalizeTelemetryErrorCode(call.errorCode);
|
|
3254
|
+
}
|
|
3255
|
+
sendEvent(
|
|
3256
|
+
run,
|
|
3257
|
+
decision,
|
|
3258
|
+
resolveInstallId(run, decision.state),
|
|
3259
|
+
MCP_TOOL_EVENT_NAME,
|
|
3260
|
+
properties
|
|
3113
3261
|
);
|
|
3114
3262
|
} catch {
|
|
3115
3263
|
}
|
|
@@ -3122,8 +3270,14 @@ function sendEvent(run, decision, distinctId, event, properties) {
|
|
|
3122
3270
|
const client = getOrCreateClient(run);
|
|
3123
3271
|
const pendingCapture = client.capture({ distinctId, event, properties });
|
|
3124
3272
|
if (pendingCapture) {
|
|
3125
|
-
|
|
3126
|
-
}))
|
|
3273
|
+
const settled = pendingCapture.catch(() => {
|
|
3274
|
+
}).then(() => {
|
|
3275
|
+
const index = run.pendingCaptures.indexOf(settled);
|
|
3276
|
+
if (index !== -1) {
|
|
3277
|
+
run.pendingCaptures.splice(index, 1);
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3280
|
+
run.pendingCaptures.push(settled);
|
|
3127
3281
|
}
|
|
3128
3282
|
}
|
|
3129
3283
|
function resolveTelemetryDecision(options) {
|
|
@@ -3342,16 +3496,16 @@ function parseReporterFormat(value) {
|
|
|
3342
3496
|
`Invalid reporter "${value}". Use "json-summary", "junit-xml", or "html".`
|
|
3343
3497
|
);
|
|
3344
3498
|
}
|
|
3345
|
-
function writeReporterResult(reporter,
|
|
3499
|
+
function writeReporterResult(reporter, report2) {
|
|
3346
3500
|
if (reporter === "junit-xml") {
|
|
3347
|
-
process.stdout.write(renderStructuredRunJUnitXml(
|
|
3501
|
+
process.stdout.write(renderStructuredRunJUnitXml(report2));
|
|
3348
3502
|
return;
|
|
3349
3503
|
}
|
|
3350
3504
|
if (reporter === "html") {
|
|
3351
|
-
process.stdout.write(renderStructuredRunHtml(
|
|
3505
|
+
process.stdout.write(renderStructuredRunHtml(report2));
|
|
3352
3506
|
return;
|
|
3353
3507
|
}
|
|
3354
|
-
writeResult(renderStructuredRunJson(
|
|
3508
|
+
writeResult(renderStructuredRunJson(report2), "json");
|
|
3355
3509
|
}
|
|
3356
3510
|
function writeEvalDecisionSummary(format, summary, destination = process.stdout, options = {}) {
|
|
3357
3511
|
if (format !== "human" || !summary) return;
|
|
@@ -3376,9 +3530,9 @@ async function writeJsonArtifact(outputPath, payload) {
|
|
|
3376
3530
|
);
|
|
3377
3531
|
}
|
|
3378
3532
|
}
|
|
3379
|
-
async function writeReporterArtifact(outputPath, reporter,
|
|
3533
|
+
async function writeReporterArtifact(outputPath, reporter, report2) {
|
|
3380
3534
|
const resolvedPath = path3.resolve(process.cwd(), outputPath);
|
|
3381
|
-
const body = reporter === "junit-xml" ? renderStructuredRunJUnitXml(
|
|
3535
|
+
const body = reporter === "junit-xml" ? renderStructuredRunJUnitXml(report2) : reporter === "html" ? renderStructuredRunHtml(report2) : `${JSON.stringify(renderStructuredRunJson(report2), null, 2)}
|
|
3382
3536
|
`;
|
|
3383
3537
|
try {
|
|
3384
3538
|
return await writeFileAtomic(resolvedPath, body, { createParents: true });
|
|
@@ -3860,7 +4014,7 @@ var InspectorApiClient = class {
|
|
|
3860
4014
|
}
|
|
3861
4015
|
throw operationalError("Inspector command response was invalid.", payload);
|
|
3862
4016
|
}
|
|
3863
|
-
async request(
|
|
4017
|
+
async request(path14, init = {}) {
|
|
3864
4018
|
const fetchRequest = async () => {
|
|
3865
4019
|
const token = await fetchInspectorSessionToken(this.baseUrl);
|
|
3866
4020
|
const { body: initBody, timeoutMs, retrySessionAuth: _retrySessionAuth, ...fetchInit } = init;
|
|
@@ -3871,7 +4025,7 @@ var InspectorApiClient = class {
|
|
|
3871
4025
|
headers.set("Content-Type", "application/json");
|
|
3872
4026
|
body = JSON.stringify(initBody);
|
|
3873
4027
|
}
|
|
3874
|
-
return await fetch(`${this.baseUrl}${
|
|
4028
|
+
return await fetch(`${this.baseUrl}${path14}`, {
|
|
3875
4029
|
...fetchInit,
|
|
3876
4030
|
signal: fetchInit.signal ?? AbortSignal.timeout(timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS),
|
|
3877
4031
|
headers,
|
|
@@ -3894,7 +4048,7 @@ var InspectorApiClient = class {
|
|
|
3894
4048
|
const payload = await readResponsePayload(response);
|
|
3895
4049
|
if (!response.ok && !init.treatAsSuccess?.(response.status, payload)) {
|
|
3896
4050
|
throw operationalError(
|
|
3897
|
-
getErrorMessage(payload) ?? `Inspector request ${
|
|
4051
|
+
getErrorMessage(payload) ?? `Inspector request ${path14} failed with ${response.status}.`,
|
|
3898
4052
|
payload
|
|
3899
4053
|
);
|
|
3900
4054
|
}
|
|
@@ -5298,7 +5452,7 @@ function registerAppsCommands(program) {
|
|
|
5298
5452
|
...config,
|
|
5299
5453
|
__suppressTelemetry: true
|
|
5300
5454
|
});
|
|
5301
|
-
captureConformanceRunEvent();
|
|
5455
|
+
captureConformanceRunEvent("apps", "single");
|
|
5302
5456
|
const result = await test.run();
|
|
5303
5457
|
const outputResult = reporter ? result : withRpcLogsIfRequested(
|
|
5304
5458
|
result,
|
|
@@ -5634,7 +5788,7 @@ function registerAppsCommands(program) {
|
|
|
5634
5788
|
// The CLI counts the run itself, under its own opt-outs.
|
|
5635
5789
|
__suppressTelemetry: true
|
|
5636
5790
|
});
|
|
5637
|
-
captureConformanceRunEvent();
|
|
5791
|
+
captureConformanceRunEvent("apps", "suite");
|
|
5638
5792
|
const result = await suite.run();
|
|
5639
5793
|
const outputResult = reporter ? result : withRpcLogsIfRequested(
|
|
5640
5794
|
result,
|
|
@@ -5816,7 +5970,7 @@ function registerCloudLinkCommands(cloud) {
|
|
|
5816
5970
|
`Project link apiUrl (${link.apiUrl}) does not match the active deployment (${deployment.apiUrl}). The active deployment's API URL is used; the link's project selector remains active.`
|
|
5817
5971
|
);
|
|
5818
5972
|
}
|
|
5819
|
-
const
|
|
5973
|
+
const report2 = {
|
|
5820
5974
|
ok,
|
|
5821
5975
|
credential: {
|
|
5822
5976
|
source: credential.source,
|
|
@@ -5842,7 +5996,7 @@ function registerCloudLinkCommands(cloud) {
|
|
|
5842
5996
|
link,
|
|
5843
5997
|
warnings
|
|
5844
5998
|
};
|
|
5845
|
-
writeResult(
|
|
5999
|
+
writeResult(report2, globalOptions.format);
|
|
5846
6000
|
if (!ok) {
|
|
5847
6001
|
setProcessExitCode(1);
|
|
5848
6002
|
}
|
|
@@ -6691,7 +6845,7 @@ async function validateImportToolReferences(client, params) {
|
|
|
6691
6845
|
return { targets, findings };
|
|
6692
6846
|
}
|
|
6693
6847
|
function finding(reference, parts) {
|
|
6694
|
-
const
|
|
6848
|
+
const path14 = [
|
|
6695
6849
|
"cases",
|
|
6696
6850
|
reference.caseIndex,
|
|
6697
6851
|
"steps",
|
|
@@ -6700,8 +6854,8 @@ function finding(reference, parts) {
|
|
|
6700
6854
|
];
|
|
6701
6855
|
return {
|
|
6702
6856
|
code: parts.code,
|
|
6703
|
-
path:
|
|
6704
|
-
pointer: suiteFilePointer(
|
|
6857
|
+
path: path14,
|
|
6858
|
+
pointer: suiteFilePointer(path14),
|
|
6705
6859
|
caseId: reference.testCase.id,
|
|
6706
6860
|
caseTitle: reference.testCase.title,
|
|
6707
6861
|
toolName: reference.step.toolName,
|
|
@@ -6832,11 +6986,11 @@ function screenshotFilename(shot, index) {
|
|
|
6832
6986
|
return `${tool}-${suffix}.png`;
|
|
6833
6987
|
}
|
|
6834
6988
|
var UNSUPPORTED_SUITE_EXPORT = "UNSUPPORTED_SUITE_EXPORT";
|
|
6835
|
-
function unsupported(
|
|
6989
|
+
function unsupported(path14, message) {
|
|
6836
6990
|
return {
|
|
6837
6991
|
code: UNSUPPORTED_SUITE_EXPORT,
|
|
6838
|
-
path:
|
|
6839
|
-
pointer: suiteFilePointer(
|
|
6992
|
+
path: path14,
|
|
6993
|
+
pointer: suiteFilePointer(path14),
|
|
6840
6994
|
message
|
|
6841
6995
|
};
|
|
6842
6996
|
}
|
|
@@ -7114,15 +7268,15 @@ function hoistProvider(cases) {
|
|
|
7114
7268
|
)
|
|
7115
7269
|
};
|
|
7116
7270
|
}
|
|
7117
|
-
function differences(expected, actual,
|
|
7271
|
+
function differences(expected, actual, path14 = [], out = []) {
|
|
7118
7272
|
if (isDeepStrictEqual(expected, actual)) return out;
|
|
7119
7273
|
const before = out.length;
|
|
7120
7274
|
if (Array.isArray(expected) && Array.isArray(actual)) {
|
|
7121
7275
|
const length = Math.max(expected.length, actual.length);
|
|
7122
7276
|
for (let index = 0; index < length; index += 1) {
|
|
7123
|
-
differences(expected[index], actual[index], [...
|
|
7277
|
+
differences(expected[index], actual[index], [...path14, index], out);
|
|
7124
7278
|
}
|
|
7125
|
-
if (out.length === before) out.push(
|
|
7279
|
+
if (out.length === before) out.push(path14);
|
|
7126
7280
|
return out;
|
|
7127
7281
|
}
|
|
7128
7282
|
const bothObjects = expected !== null && actual !== null && typeof expected === "object" && typeof actual === "object" && !Array.isArray(expected) && !Array.isArray(actual);
|
|
@@ -7137,14 +7291,14 @@ function differences(expected, actual, path12 = [], out = []) {
|
|
|
7137
7291
|
differences(
|
|
7138
7292
|
expected[key],
|
|
7139
7293
|
actual[key],
|
|
7140
|
-
[...
|
|
7294
|
+
[...path14, key],
|
|
7141
7295
|
out
|
|
7142
7296
|
);
|
|
7143
7297
|
}
|
|
7144
|
-
if (out.length === before) out.push(
|
|
7298
|
+
if (out.length === before) out.push(path14);
|
|
7145
7299
|
return out;
|
|
7146
7300
|
}
|
|
7147
|
-
out.push(
|
|
7301
|
+
out.push(path14);
|
|
7148
7302
|
return out;
|
|
7149
7303
|
}
|
|
7150
7304
|
function buildSuiteFileFromPlatform(input, options = {}) {
|
|
@@ -7279,8 +7433,8 @@ function buildSuiteFileFromPlatform(input, options = {}) {
|
|
|
7279
7433
|
return {
|
|
7280
7434
|
ok: false,
|
|
7281
7435
|
findings: lost.map(
|
|
7282
|
-
(
|
|
7283
|
-
|
|
7436
|
+
(path14) => unsupported(
|
|
7437
|
+
path14,
|
|
7284
7438
|
`the suite file contract does not carry this value, so exporting would drop it. Nothing was written.`
|
|
7285
7439
|
)
|
|
7286
7440
|
)
|
|
@@ -8253,8 +8407,8 @@ function renderCorpusDrift(drift) {
|
|
|
8253
8407
|
}
|
|
8254
8408
|
|
|
8255
8409
|
// src/lib/eval-gate-exit-code.ts
|
|
8256
|
-
function evalGateExitCode(
|
|
8257
|
-
switch (
|
|
8410
|
+
function evalGateExitCode(report2) {
|
|
8411
|
+
switch (report2.outcome) {
|
|
8258
8412
|
case "passed":
|
|
8259
8413
|
return 0;
|
|
8260
8414
|
// An authorized, recorded, time-boxed override of a real failure. Exit 0,
|
|
@@ -8842,11 +8996,11 @@ async function evaluateBaselineComparison(input) {
|
|
|
8842
8996
|
};
|
|
8843
8997
|
}
|
|
8844
8998
|
if (importEvidenceBlocksGate(baseRun)) {
|
|
8845
|
-
const
|
|
8999
|
+
const report2 = importIneligibleReport(baseRun);
|
|
8846
9000
|
return {
|
|
8847
9001
|
report: {
|
|
8848
|
-
...
|
|
8849
|
-
verdicts:
|
|
9002
|
+
...report2,
|
|
9003
|
+
verdicts: report2.verdicts.map((verdict) => ({
|
|
8850
9004
|
...verdict,
|
|
8851
9005
|
gate: "baseline",
|
|
8852
9006
|
message: `baseline run ${compare.baseRun.runNumber}: ${verdict.message}`
|
|
@@ -9750,9 +9904,9 @@ function launchFailureCases(result) {
|
|
|
9750
9904
|
];
|
|
9751
9905
|
});
|
|
9752
9906
|
}
|
|
9753
|
-
function gateReportCase(
|
|
9754
|
-
const waived =
|
|
9755
|
-
const passed =
|
|
9907
|
+
function gateReportCase(report2, baselineProvenance) {
|
|
9908
|
+
const waived = report2.outcome === "waived";
|
|
9909
|
+
const passed = report2.outcome === "passed" || waived;
|
|
9756
9910
|
return {
|
|
9757
9911
|
id: "gate",
|
|
9758
9912
|
title: waived ? "Eval gate (WAIVED)" : "Eval gate",
|
|
@@ -9763,7 +9917,7 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
9763
9917
|
// way), but reporting them as `breaking` — the same class a genuine
|
|
9764
9918
|
// failure gets — would claim a defect the run never observed. Mirrors
|
|
9765
9919
|
// `gateCase` in sdk/src/run-compare.ts.
|
|
9766
|
-
classification:
|
|
9920
|
+
classification: report2.outcome === "failed" ? "breaking" : (
|
|
9767
9921
|
// A waived gate is `informational`, NOT `non_breaking`. It really did
|
|
9768
9922
|
// fail; `non_breaking` would claim the run observed no breaking change,
|
|
9769
9923
|
// which is the opposite of what happened.
|
|
@@ -9773,26 +9927,26 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
9773
9927
|
// explains why the build was not blocked; it is not a reason to stop
|
|
9774
9928
|
// saying what failed.
|
|
9775
9929
|
...passed && !waived ? {} : {
|
|
9776
|
-
error:
|
|
9930
|
+
error: report2.verdicts.filter(
|
|
9777
9931
|
(verdict) => verdict.status !== "passed" && verdict.status !== "waived"
|
|
9778
9932
|
).map((verdict) => verdict.message).join("; ")
|
|
9779
9933
|
},
|
|
9780
|
-
...
|
|
9934
|
+
...report2.waiver ? {
|
|
9781
9935
|
waiver: {
|
|
9782
|
-
id:
|
|
9783
|
-
reason:
|
|
9784
|
-
expiresAt:
|
|
9785
|
-
createdAt:
|
|
9786
|
-
createdBy:
|
|
9787
|
-
createdByEmail:
|
|
9788
|
-
policySnapshot:
|
|
9936
|
+
id: report2.waiver.id,
|
|
9937
|
+
reason: report2.waiver.reason,
|
|
9938
|
+
expiresAt: report2.waiver.expiresAt,
|
|
9939
|
+
createdAt: report2.waiver.createdAt,
|
|
9940
|
+
createdBy: report2.waiver.createdBy,
|
|
9941
|
+
createdByEmail: report2.waiver.createdByEmail,
|
|
9942
|
+
policySnapshot: report2.waiver.policySnapshot
|
|
9789
9943
|
}
|
|
9790
9944
|
} : {},
|
|
9791
9945
|
// The baseline provenance rides along on the case row too, not only in
|
|
9792
9946
|
// the report's top-level metadata: `--reporter junit-xml` has no other
|
|
9793
9947
|
// place to carry it, and a regression visible in the exit code but
|
|
9794
9948
|
// absent from the artifact is a reporting bug.
|
|
9795
|
-
details: baselineProvenance ? { ...
|
|
9949
|
+
details: baselineProvenance ? { ...report2, baseline: baselineProvenance } : report2
|
|
9796
9950
|
};
|
|
9797
9951
|
}
|
|
9798
9952
|
var DEFAULT_GATE_WAIT_TIMEOUT_MS = 35 * 6e4;
|
|
@@ -10026,7 +10180,7 @@ async function runEvalGate(options, command) {
|
|
|
10026
10180
|
throw error;
|
|
10027
10181
|
}
|
|
10028
10182
|
const detail = error instanceof Error ? error.message : String(error);
|
|
10029
|
-
const
|
|
10183
|
+
const report3 = {
|
|
10030
10184
|
outcome: "incomplete",
|
|
10031
10185
|
scoreIntegrity: "unknown",
|
|
10032
10186
|
verdicts: [
|
|
@@ -10038,8 +10192,8 @@ async function runEvalGate(options, command) {
|
|
|
10038
10192
|
]
|
|
10039
10193
|
};
|
|
10040
10194
|
const structured2 = needsReport ? buildEvalRunReport([], {
|
|
10041
|
-
cases: [gateReportCase(
|
|
10042
|
-
verdict: gateOutcomeVerdict(
|
|
10195
|
+
cases: [gateReportCase(report3)],
|
|
10196
|
+
verdict: gateOutcomeVerdict(report3.outcome)
|
|
10043
10197
|
}) : void 0;
|
|
10044
10198
|
if (options.out && structured2) {
|
|
10045
10199
|
await writeReporterArtifact(
|
|
@@ -10052,20 +10206,20 @@ async function runEvalGate(options, command) {
|
|
|
10052
10206
|
writeReporterResult(reporter, structured2);
|
|
10053
10207
|
} else {
|
|
10054
10208
|
writeResult(
|
|
10055
|
-
{ gate:
|
|
10209
|
+
{ gate: report3, exitCode: EVAL_GATE_INCOMPLETE_EXIT_CODE },
|
|
10056
10210
|
globalOptions.format
|
|
10057
10211
|
);
|
|
10058
10212
|
}
|
|
10059
10213
|
setProcessExitCode(EVAL_GATE_INCOMPLETE_EXIT_CODE);
|
|
10060
10214
|
return;
|
|
10061
10215
|
}
|
|
10062
|
-
const
|
|
10216
|
+
const report2 = applyGateWaiver(
|
|
10063
10217
|
outcome.report,
|
|
10064
10218
|
activeWaiverForRun(outcome.run)
|
|
10065
10219
|
);
|
|
10066
10220
|
let suiteGate;
|
|
10067
10221
|
let suiteGateSkip;
|
|
10068
|
-
let composedOutcome =
|
|
10222
|
+
let composedOutcome = report2.outcome;
|
|
10069
10223
|
if (options.suitePolicy !== false && resolvedProjectId) {
|
|
10070
10224
|
const fetched = await runPlatformOperation(
|
|
10071
10225
|
platformOptionsOf(command),
|
|
@@ -10102,27 +10256,27 @@ async function runEvalGate(options, command) {
|
|
|
10102
10256
|
if (fetched.kind === "report") {
|
|
10103
10257
|
suiteGate = fetched.report;
|
|
10104
10258
|
composedOutcome = composeSuiteGateWithBaseReport({
|
|
10105
|
-
base: { outcome:
|
|
10259
|
+
base: { outcome: report2.outcome },
|
|
10106
10260
|
suite: fetched.report
|
|
10107
10261
|
}).outcome;
|
|
10108
10262
|
} else if (fetched.kind === "skip") {
|
|
10109
10263
|
suiteGateSkip = fetched.message;
|
|
10110
10264
|
} else {
|
|
10111
10265
|
suiteGateSkip = fetched.message;
|
|
10112
|
-
if (
|
|
10266
|
+
if (report2.outcome === "passed" || report2.outcome === "waived") {
|
|
10113
10267
|
composedOutcome = "incomplete";
|
|
10114
10268
|
}
|
|
10115
10269
|
}
|
|
10116
10270
|
}
|
|
10117
10271
|
const composedReport = {
|
|
10118
|
-
...
|
|
10272
|
+
...report2,
|
|
10119
10273
|
outcome: composedOutcome === "unavailable" ? "incomplete" : composedOutcome,
|
|
10120
10274
|
// The suite gate's own conditions ride into the report's verdict list, so
|
|
10121
10275
|
// every renderer — human, JUnit, HTML — names the condition that turned
|
|
10122
10276
|
// CI red. Without them a suite-gate failure prints "Gate: FAILED" over
|
|
10123
10277
|
// nothing but PASS rows, and the JUnit failure message is empty.
|
|
10124
10278
|
verdicts: suiteGate ? [
|
|
10125
|
-
...
|
|
10279
|
+
...report2.verdicts,
|
|
10126
10280
|
...suiteGate.conditions.filter((condition) => condition.status !== "passed").map((condition) => ({
|
|
10127
10281
|
gate: `suiteGate:${condition.condition}`,
|
|
10128
10282
|
status: condition.status === "failed" ? "failed" : "non_gateable",
|
|
@@ -10130,7 +10284,7 @@ async function runEvalGate(options, command) {
|
|
|
10130
10284
|
...typeof condition.observed === "number" ? { observed: condition.observed } : {},
|
|
10131
10285
|
...typeof condition.threshold === "number" ? { threshold: condition.threshold } : {}
|
|
10132
10286
|
}))
|
|
10133
|
-
] :
|
|
10287
|
+
] : report2.verdicts
|
|
10134
10288
|
};
|
|
10135
10289
|
const exitCode = evalGateExitCode(composedReport);
|
|
10136
10290
|
const structured = needsReport ? buildEvalRunReport(
|
|
@@ -10384,7 +10538,7 @@ async function runEvalCompare(options, command) {
|
|
|
10384
10538
|
}
|
|
10385
10539
|
const reason = baselineNotFoundReason(error);
|
|
10386
10540
|
const detail = error instanceof Error ? error.message : String(error);
|
|
10387
|
-
const
|
|
10541
|
+
const report2 = {
|
|
10388
10542
|
outcome: "incomplete",
|
|
10389
10543
|
scoreIntegrity: "unknown",
|
|
10390
10544
|
verdicts: [
|
|
@@ -10396,11 +10550,11 @@ async function runEvalCompare(options, command) {
|
|
|
10396
10550
|
]
|
|
10397
10551
|
};
|
|
10398
10552
|
await writeCompareResult(
|
|
10399
|
-
{ report, reporter, out: options.out, format: globalOptions.format },
|
|
10553
|
+
{ report: report2, reporter, out: options.out, format: globalOptions.format },
|
|
10400
10554
|
// Built whenever EITHER output channel was requested. `--reporter` needs
|
|
10401
10555
|
// it to emit JUnit rather than JSON; `--out` needs it so a CI step
|
|
10402
10556
|
// reading the artifact finds the verdict instead of a missing file.
|
|
10403
|
-
reporter || options.out ? emptyCompareReport(
|
|
10557
|
+
reporter || options.out ? emptyCompareReport(report2) : void 0
|
|
10404
10558
|
);
|
|
10405
10559
|
setProcessExitCode(EVAL_GATE_INCOMPLETE_EXIT_CODE);
|
|
10406
10560
|
return;
|
|
@@ -10526,7 +10680,7 @@ async function runEvalPull(options, command) {
|
|
|
10526
10680
|
globalOptions.format
|
|
10527
10681
|
);
|
|
10528
10682
|
}
|
|
10529
|
-
function emptyCompareReport(
|
|
10683
|
+
function emptyCompareReport(report2) {
|
|
10530
10684
|
return buildRunCompareReport(
|
|
10531
10685
|
{
|
|
10532
10686
|
suite: { id: "", name: "" },
|
|
@@ -10576,7 +10730,7 @@ function emptyCompareReport(report) {
|
|
|
10576
10730
|
},
|
|
10577
10731
|
cases: []
|
|
10578
10732
|
},
|
|
10579
|
-
|
|
10733
|
+
report2
|
|
10580
10734
|
);
|
|
10581
10735
|
}
|
|
10582
10736
|
var EMPTY_DIFF = {
|
|
@@ -11368,7 +11522,7 @@ function registerEvalCommands(program) {
|
|
|
11368
11522
|
quiet: true
|
|
11369
11523
|
}
|
|
11370
11524
|
);
|
|
11371
|
-
const
|
|
11525
|
+
const report2 = needsReport ? buildEvalRunReport(completion.reportInputs, {
|
|
11372
11526
|
cases: [
|
|
11373
11527
|
...launchFailureCases(result),
|
|
11374
11528
|
...completion.waitErrors.map((entry) => ({
|
|
@@ -11408,19 +11562,19 @@ function registerEvalCommands(program) {
|
|
|
11408
11562
|
waitErrors: completion.waitErrors
|
|
11409
11563
|
});
|
|
11410
11564
|
let outWriteError;
|
|
11411
|
-
if (options.out &&
|
|
11565
|
+
if (options.out && report2) {
|
|
11412
11566
|
try {
|
|
11413
11567
|
await writeReporterArtifact(
|
|
11414
11568
|
options.out,
|
|
11415
11569
|
reporter ?? "json-summary",
|
|
11416
|
-
|
|
11570
|
+
report2
|
|
11417
11571
|
);
|
|
11418
11572
|
} catch (error) {
|
|
11419
11573
|
outWriteError = error instanceof Error ? error.message : String(error);
|
|
11420
11574
|
}
|
|
11421
11575
|
}
|
|
11422
|
-
if (reporter &&
|
|
11423
|
-
writeReporterResult(reporter,
|
|
11576
|
+
if (reporter && report2) {
|
|
11577
|
+
writeReporterResult(reporter, report2);
|
|
11424
11578
|
} else {
|
|
11425
11579
|
writeResult(
|
|
11426
11580
|
{
|
|
@@ -12318,15 +12472,15 @@ function registerEvalCommands(program) {
|
|
|
12318
12472
|
shot.screenshotUrl,
|
|
12319
12473
|
globalOptions.timeout
|
|
12320
12474
|
);
|
|
12321
|
-
const
|
|
12475
|
+
const path14 = resolveScreenshotPath(
|
|
12322
12476
|
options.out,
|
|
12323
12477
|
shot,
|
|
12324
12478
|
i,
|
|
12325
12479
|
shots.length
|
|
12326
12480
|
);
|
|
12327
|
-
mkdirSync(dirname(
|
|
12328
|
-
writeFileSync(
|
|
12329
|
-
saved.push({ ...shot, savedTo:
|
|
12481
|
+
mkdirSync(dirname(path14), { recursive: true });
|
|
12482
|
+
writeFileSync(path14, bytes);
|
|
12483
|
+
saved.push({ ...shot, savedTo: path14 });
|
|
12330
12484
|
}
|
|
12331
12485
|
let video;
|
|
12332
12486
|
if (options.video) {
|
|
@@ -12891,12 +13045,12 @@ ${summary}
|
|
|
12891
13045
|
}
|
|
12892
13046
|
);
|
|
12893
13047
|
}
|
|
12894
|
-
function readDetails(
|
|
13048
|
+
function readDetails(path14) {
|
|
12895
13049
|
try {
|
|
12896
|
-
return
|
|
13050
|
+
return path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
12897
13051
|
} catch (error) {
|
|
12898
13052
|
throw usageError(
|
|
12899
|
-
|
|
13053
|
+
path14 === "-" ? "Failed to read --details from stdin." : `Failed to read --details from "${path14}".`,
|
|
12900
13054
|
{ source: error instanceof Error ? error.message : String(error) }
|
|
12901
13055
|
);
|
|
12902
13056
|
}
|
|
@@ -13382,11 +13536,11 @@ function registerCloudConformanceCommands(cloud) {
|
|
|
13382
13536
|
getConformanceRunOperation,
|
|
13383
13537
|
(options) => ({ project: options.project, run: options.run })
|
|
13384
13538
|
);
|
|
13385
|
-
const
|
|
13539
|
+
const report2 = addProjectOption(
|
|
13386
13540
|
conformance.command("report").description("Page through a run's failing checks, 50 at a time").requiredOption("--run <id>", "Conformance run id").option("--cursor <cursor>", "The nextCursor of the previous page")
|
|
13387
13541
|
);
|
|
13388
13542
|
bindOperation(
|
|
13389
|
-
|
|
13543
|
+
report2,
|
|
13390
13544
|
getConformanceReportOperation,
|
|
13391
13545
|
(options) => ({
|
|
13392
13546
|
project: options.project,
|
|
@@ -14361,7 +14515,7 @@ Or stop it with:
|
|
|
14361
14515
|
mcpjam cloud projects servers connect-cancel --request ${created.connectionRequestId}
|
|
14362
14516
|
`
|
|
14363
14517
|
);
|
|
14364
|
-
|
|
14518
|
+
setProcessExitCode(1);
|
|
14365
14519
|
}
|
|
14366
14520
|
}
|
|
14367
14521
|
);
|
|
@@ -14445,6 +14599,7 @@ async function pollConnection(options, timeoutMs, connectionRequestId, expiresAt
|
|
|
14445
14599
|
let lastResult;
|
|
14446
14600
|
const onInterrupt = () => {
|
|
14447
14601
|
interrupted = true;
|
|
14602
|
+
recordCommandOutcome("interrupted");
|
|
14448
14603
|
process.stderr.write(
|
|
14449
14604
|
"\nStopped watching. The request continues in the cloud \u2014 open the link above to finish it.\n"
|
|
14450
14605
|
);
|
|
@@ -14916,12 +15071,12 @@ function resolveSecretValue(options, { required }) {
|
|
|
14916
15071
|
}
|
|
14917
15072
|
return value;
|
|
14918
15073
|
}
|
|
14919
|
-
const readStdinOrFile = (
|
|
15074
|
+
const readStdinOrFile = (path14) => {
|
|
14920
15075
|
try {
|
|
14921
|
-
return
|
|
15076
|
+
return path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
14922
15077
|
} catch (error) {
|
|
14923
15078
|
throw usageError(
|
|
14924
|
-
|
|
15079
|
+
path14 === "-" ? "Failed to read the secret value from stdin." : `Failed to read the secret value from "${path14}".`,
|
|
14925
15080
|
{ source: error instanceof Error ? error.message : String(error) }
|
|
14926
15081
|
);
|
|
14927
15082
|
}
|
|
@@ -15134,13 +15289,13 @@ function nonEmptyToken(text, what) {
|
|
|
15134
15289
|
}
|
|
15135
15290
|
return token;
|
|
15136
15291
|
}
|
|
15137
|
-
function readTokenFrom(
|
|
15292
|
+
function readTokenFrom(path14, what) {
|
|
15138
15293
|
let text;
|
|
15139
15294
|
try {
|
|
15140
|
-
text =
|
|
15295
|
+
text = path14 === "-" ? readFileSync(0, "utf8") : readFileSync(path14, "utf8");
|
|
15141
15296
|
} catch (error) {
|
|
15142
15297
|
throw usageError(
|
|
15143
|
-
|
|
15298
|
+
path14 === "-" ? `Could not read the ${what} from stdin. Pipe it in, or read it from a file.` : `Could not read the ${what} from "${path14}". Check the path and that you can read the file.`,
|
|
15144
15299
|
{ source: error instanceof Error ? error.message : String(error) }
|
|
15145
15300
|
);
|
|
15146
15301
|
}
|
|
@@ -15223,13 +15378,13 @@ function accountCommand(accounts, name, description) {
|
|
|
15223
15378
|
}
|
|
15224
15379
|
function registerServerAccountsCommands(cloud) {
|
|
15225
15380
|
const accounts = cloud.command("server-accounts").description(
|
|
15226
|
-
"Manage the accounts a saved server signs in with
|
|
15381
|
+
"Manage the accounts a saved server signs in with. Write-only: no command prints a token."
|
|
15227
15382
|
);
|
|
15228
15383
|
bindOperation(
|
|
15229
15384
|
serverCommand(
|
|
15230
15385
|
accounts,
|
|
15231
15386
|
"list",
|
|
15232
|
-
"List a saved server's accounts: id, name, whether runs use it by default, whether it needs reconnecting, and whether it is
|
|
15387
|
+
"List a saved server's accounts: id, name, whether runs use it by default, whether it needs reconnecting, and whether it is a shared or uploaded account whose token is never revealed"
|
|
15233
15388
|
),
|
|
15234
15389
|
listServerAccountsOperation,
|
|
15235
15390
|
(options) => ({
|
|
@@ -15250,7 +15405,7 @@ function registerServerAccountsCommands(cloud) {
|
|
|
15250
15405
|
accountCommand(
|
|
15251
15406
|
accounts,
|
|
15252
15407
|
"set",
|
|
15253
|
-
"Upload an access token to an account. A name no account has creates the account; otherwise its token is replaced and its ID stays.
|
|
15408
|
+
"Upload an access token to an account. A name no account has creates the account; otherwise its token is replaced and its ID stays. The token is never revealed. Hosted runs use it. On a shared server, members' local apps use it once a project admin allows local runs; on your own server, only your local app does"
|
|
15254
15409
|
).requiredOption(
|
|
15255
15410
|
"--client-id <id>",
|
|
15256
15411
|
"The OAuth client the token was issued to"
|
|
@@ -15485,15 +15640,15 @@ function registerSessionsBrowserCommands(sessions) {
|
|
|
15485
15640
|
const extension = bytes[0] === 255 && bytes[1] === 216 ? "jpg" : "png";
|
|
15486
15641
|
const dir = resolve(download);
|
|
15487
15642
|
await mkdir(dir, { recursive: true });
|
|
15488
|
-
const
|
|
15643
|
+
const path14 = resolve(
|
|
15489
15644
|
dir,
|
|
15490
15645
|
`${(wire.commandId ?? "screenshot").replace(
|
|
15491
15646
|
/[^A-Za-z0-9_.-]/g,
|
|
15492
15647
|
"_"
|
|
15493
15648
|
)}.${extension}`
|
|
15494
15649
|
);
|
|
15495
|
-
await writeFile(
|
|
15496
|
-
return { ...result, savedTo:
|
|
15650
|
+
await writeFile(path14, bytes);
|
|
15651
|
+
return { ...result, savedTo: path14 };
|
|
15497
15652
|
}
|
|
15498
15653
|
},
|
|
15499
15654
|
(o) => {
|
|
@@ -16330,8 +16485,8 @@ function resolveHeaders(options) {
|
|
|
16330
16485
|
put(name, value, "--header-env");
|
|
16331
16486
|
}
|
|
16332
16487
|
for (const raw of options.headerFile ?? []) {
|
|
16333
|
-
const [name,
|
|
16334
|
-
const target =
|
|
16488
|
+
const [name, path14] = splitOnFirst(raw, "=", "--header-file");
|
|
16489
|
+
const target = path14.trim();
|
|
16335
16490
|
let contents;
|
|
16336
16491
|
try {
|
|
16337
16492
|
contents = target === "-" ? readFileSync(0, "utf8") : readFileSync(target, "utf8");
|
|
@@ -17676,11 +17831,12 @@ Registered server "${result.grant.name ?? options.server}" in project "${result.
|
|
|
17676
17831
|
const onSignal = () => {
|
|
17677
17832
|
sigints += 1;
|
|
17678
17833
|
if (sigints === 1) {
|
|
17834
|
+
recordCommandOutcome("interrupted");
|
|
17679
17835
|
status("Shutting down tunnel... (Ctrl-C again to force quit)");
|
|
17680
17836
|
void session.stop();
|
|
17681
17837
|
return;
|
|
17682
17838
|
}
|
|
17683
|
-
|
|
17839
|
+
void exitInterrupted();
|
|
17684
17840
|
};
|
|
17685
17841
|
process.on("SIGINT", onSignal);
|
|
17686
17842
|
process.on("SIGTERM", onSignal);
|
|
@@ -18874,6 +19030,64 @@ function estimateTokensFromChars(text) {
|
|
|
18874
19030
|
return Math.ceil(text.length / 4);
|
|
18875
19031
|
}
|
|
18876
19032
|
|
|
19033
|
+
// src/lib/mcp-tool-runner.ts
|
|
19034
|
+
function toToolResult(payload) {
|
|
19035
|
+
return {
|
|
19036
|
+
content: [
|
|
19037
|
+
{
|
|
19038
|
+
type: "text",
|
|
19039
|
+
text: JSON.stringify(payload, null, 2)
|
|
19040
|
+
}
|
|
19041
|
+
]
|
|
19042
|
+
};
|
|
19043
|
+
}
|
|
19044
|
+
function toToolError(normalized) {
|
|
19045
|
+
return {
|
|
19046
|
+
isError: true,
|
|
19047
|
+
content: [
|
|
19048
|
+
{
|
|
19049
|
+
type: "text",
|
|
19050
|
+
text: JSON.stringify(
|
|
19051
|
+
{
|
|
19052
|
+
error: {
|
|
19053
|
+
code: normalized.code,
|
|
19054
|
+
message: normalized.message,
|
|
19055
|
+
...normalized.details === void 0 ? {} : { details: normalized.details }
|
|
19056
|
+
}
|
|
19057
|
+
},
|
|
19058
|
+
null,
|
|
19059
|
+
2
|
|
19060
|
+
)
|
|
19061
|
+
}
|
|
19062
|
+
]
|
|
19063
|
+
};
|
|
19064
|
+
}
|
|
19065
|
+
function createToolRunner(onToolCalled) {
|
|
19066
|
+
const report2 = (call) => {
|
|
19067
|
+
try {
|
|
19068
|
+
onToolCalled?.(call);
|
|
19069
|
+
} catch {
|
|
19070
|
+
}
|
|
19071
|
+
};
|
|
19072
|
+
return async (tool, operation) => {
|
|
19073
|
+
const startedAt = Date.now();
|
|
19074
|
+
try {
|
|
19075
|
+
const result = toToolResult(await operation());
|
|
19076
|
+
report2({ tool, success: true, durationMs: Date.now() - startedAt });
|
|
19077
|
+
return result;
|
|
19078
|
+
} catch (error) {
|
|
19079
|
+
const normalized = normalizeCliError(error);
|
|
19080
|
+
report2({
|
|
19081
|
+
tool,
|
|
19082
|
+
success: false,
|
|
19083
|
+
durationMs: Date.now() - startedAt,
|
|
19084
|
+
errorCode: normalized.code
|
|
19085
|
+
});
|
|
19086
|
+
return toToolError(normalized);
|
|
19087
|
+
}
|
|
19088
|
+
};
|
|
19089
|
+
}
|
|
19090
|
+
|
|
18877
19091
|
// src/lib/mcp-server.ts
|
|
18878
19092
|
var NOTIFICATION_BUFFER_LIMIT = 1e3;
|
|
18879
19093
|
var WATCHED_NOTIFICATION_METHODS = [
|
|
@@ -18990,47 +19204,9 @@ function withToolResultAuthChallenge(result) {
|
|
|
18990
19204
|
_authChallenge: { ...challenge, hint: authChallengeHint(challenge) }
|
|
18991
19205
|
};
|
|
18992
19206
|
}
|
|
18993
|
-
function toToolResult(payload) {
|
|
18994
|
-
return {
|
|
18995
|
-
content: [
|
|
18996
|
-
{
|
|
18997
|
-
type: "text",
|
|
18998
|
-
text: JSON.stringify(payload, null, 2)
|
|
18999
|
-
}
|
|
19000
|
-
]
|
|
19001
|
-
};
|
|
19002
|
-
}
|
|
19003
|
-
function toToolError(error) {
|
|
19004
|
-
const normalized = normalizeCliError(error);
|
|
19005
|
-
return {
|
|
19006
|
-
isError: true,
|
|
19007
|
-
content: [
|
|
19008
|
-
{
|
|
19009
|
-
type: "text",
|
|
19010
|
-
text: JSON.stringify(
|
|
19011
|
-
{
|
|
19012
|
-
error: {
|
|
19013
|
-
code: normalized.code,
|
|
19014
|
-
message: normalized.message,
|
|
19015
|
-
...normalized.details === void 0 ? {} : { details: normalized.details }
|
|
19016
|
-
}
|
|
19017
|
-
},
|
|
19018
|
-
null,
|
|
19019
|
-
2
|
|
19020
|
-
)
|
|
19021
|
-
}
|
|
19022
|
-
]
|
|
19023
|
-
};
|
|
19024
|
-
}
|
|
19025
|
-
async function runTool(operation) {
|
|
19026
|
-
try {
|
|
19027
|
-
return toToolResult(await operation());
|
|
19028
|
-
} catch (error) {
|
|
19029
|
-
return toToolError(error);
|
|
19030
|
-
}
|
|
19031
|
-
}
|
|
19032
19207
|
function createMcpJamMcpServer(options) {
|
|
19033
19208
|
const defaultTimeoutMs = options.defaultTimeoutMs ?? 3e4;
|
|
19209
|
+
const runTool = createToolRunner(options.onToolCalled);
|
|
19034
19210
|
const manager = new MCPClientManager(
|
|
19035
19211
|
{},
|
|
19036
19212
|
{
|
|
@@ -19120,7 +19296,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19120
19296
|
}),
|
|
19121
19297
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
19122
19298
|
},
|
|
19123
|
-
async (input) => runTool(async () => {
|
|
19299
|
+
async (input) => runTool("connect_server", async () => {
|
|
19124
19300
|
const { config } = buildTargetConfig(input, defaultTimeoutMs);
|
|
19125
19301
|
const requestedName = input.name?.trim();
|
|
19126
19302
|
if (requestedName && manager.hasServer(requestedName)) {
|
|
@@ -19153,7 +19329,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19153
19329
|
}),
|
|
19154
19330
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
19155
19331
|
},
|
|
19156
|
-
async ({ server: name }) => runTool(async () => {
|
|
19332
|
+
async ({ server: name }) => runTool("disconnect_server", async () => {
|
|
19157
19333
|
if (!manager.hasServer(name)) {
|
|
19158
19334
|
throw usageError(`Unknown server "${name}".`);
|
|
19159
19335
|
}
|
|
@@ -19174,7 +19350,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19174
19350
|
inputSchema: z.object({}),
|
|
19175
19351
|
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
19176
19352
|
},
|
|
19177
|
-
async () => runTool(async () => ({
|
|
19353
|
+
async () => runTool("list_servers", async () => ({
|
|
19178
19354
|
servers: manager.listServers().map(describeServer)
|
|
19179
19355
|
}))
|
|
19180
19356
|
);
|
|
@@ -19188,7 +19364,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19188
19364
|
}),
|
|
19189
19365
|
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
19190
19366
|
},
|
|
19191
|
-
async ({ server: name }) => runTool(async () => {
|
|
19367
|
+
async ({ server: name }) => runTool("server_info", async () => {
|
|
19192
19368
|
requireConnected(name);
|
|
19193
19369
|
return {
|
|
19194
19370
|
server: name,
|
|
@@ -19206,7 +19382,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19206
19382
|
}),
|
|
19207
19383
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19208
19384
|
},
|
|
19209
|
-
async ({ server: name }) => runTool(async () => {
|
|
19385
|
+
async ({ server: name }) => runTool("ping_server", async () => {
|
|
19210
19386
|
requireConnected(name);
|
|
19211
19387
|
const startedAt = Date.now();
|
|
19212
19388
|
await manager.pingServer(name);
|
|
@@ -19228,7 +19404,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19228
19404
|
}),
|
|
19229
19405
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19230
19406
|
},
|
|
19231
|
-
async ({ server: name, cursor }) => runTool(async () => {
|
|
19407
|
+
async ({ server: name, cursor }) => runTool("list_tools", async () => {
|
|
19232
19408
|
requireConnected(name);
|
|
19233
19409
|
return listToolsWithMetadata(manager, { serverId: name, cursor });
|
|
19234
19410
|
})
|
|
@@ -19245,7 +19421,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19245
19421
|
}),
|
|
19246
19422
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
19247
19423
|
},
|
|
19248
|
-
async ({ server: name, tool, arguments: args }) => runTool(async () => {
|
|
19424
|
+
async ({ server: name, tool, arguments: args }) => runTool("call_tool", async () => {
|
|
19249
19425
|
requireConnected(name);
|
|
19250
19426
|
return withToolResultAuthChallenge(
|
|
19251
19427
|
await manager.executeTool(name, tool, args ?? {})
|
|
@@ -19264,7 +19440,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19264
19440
|
}),
|
|
19265
19441
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19266
19442
|
},
|
|
19267
|
-
async ({ server: name, cursor, templates }) => runTool(async () => {
|
|
19443
|
+
async ({ server: name, cursor, templates }) => runTool("list_resources", async () => {
|
|
19268
19444
|
requireConnected(name);
|
|
19269
19445
|
const params = cursor !== void 0 ? { cursor } : void 0;
|
|
19270
19446
|
return templates ? manager.listResourceTemplates(name, params) : manager.listResources(name, params);
|
|
@@ -19281,7 +19457,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19281
19457
|
}),
|
|
19282
19458
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19283
19459
|
},
|
|
19284
|
-
async ({ server: name, uri }) => runTool(async () => {
|
|
19460
|
+
async ({ server: name, uri }) => runTool("read_resource", async () => {
|
|
19285
19461
|
requireConnected(name);
|
|
19286
19462
|
return manager.readResource(name, { uri });
|
|
19287
19463
|
})
|
|
@@ -19296,7 +19472,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19296
19472
|
}),
|
|
19297
19473
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19298
19474
|
},
|
|
19299
|
-
async ({ server: name }) => runTool(async () => {
|
|
19475
|
+
async ({ server: name }) => runTool("list_skills", async () => {
|
|
19300
19476
|
requireConnected(name);
|
|
19301
19477
|
return listServerSkillCatalog(manager, name);
|
|
19302
19478
|
})
|
|
@@ -19314,7 +19490,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19314
19490
|
}),
|
|
19315
19491
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19316
19492
|
},
|
|
19317
|
-
async ({ server: name, uri }) => runTool(async () => {
|
|
19493
|
+
async ({ server: name, uri }) => runTool("get_skill", async () => {
|
|
19318
19494
|
requireConnected(name);
|
|
19319
19495
|
try {
|
|
19320
19496
|
return { skill: await getVerifiedServerSkill(manager, { serverId: name, uri }) };
|
|
@@ -19338,7 +19514,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19338
19514
|
}),
|
|
19339
19515
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19340
19516
|
},
|
|
19341
|
-
async ({ server: name, skillUri, resourceUri }) => runTool(async () => {
|
|
19517
|
+
async ({ server: name, skillUri, resourceUri }) => runTool("read_skill_file", async () => {
|
|
19342
19518
|
requireConnected(name);
|
|
19343
19519
|
try {
|
|
19344
19520
|
const skill = await getVerifiedServerSkill(manager, {
|
|
@@ -19369,7 +19545,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19369
19545
|
}),
|
|
19370
19546
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19371
19547
|
},
|
|
19372
|
-
async ({ server: name, cursor }) => runTool(async () => {
|
|
19548
|
+
async ({ server: name, cursor }) => runTool("list_prompts", async () => {
|
|
19373
19549
|
requireConnected(name);
|
|
19374
19550
|
return manager.listPrompts(
|
|
19375
19551
|
name,
|
|
@@ -19389,7 +19565,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19389
19565
|
}),
|
|
19390
19566
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19391
19567
|
},
|
|
19392
|
-
async ({ server: name, prompt, arguments: args }) => runTool(async () => {
|
|
19568
|
+
async ({ server: name, prompt, arguments: args }) => runTool("get_prompt", async () => {
|
|
19393
19569
|
requireConnected(name);
|
|
19394
19570
|
return manager.getPrompt(name, {
|
|
19395
19571
|
name: prompt,
|
|
@@ -19409,7 +19585,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19409
19585
|
}),
|
|
19410
19586
|
annotations: { readOnlyHint: false, openWorldHint: false }
|
|
19411
19587
|
},
|
|
19412
|
-
async ({ server: name, method, clear }) => runTool(async () => {
|
|
19588
|
+
async ({ server: name, method, clear }) => runTool("get_notifications", async () => {
|
|
19413
19589
|
const matches = notifications.filter(
|
|
19414
19590
|
(entry) => (!name || entry.server === name) && (!method || entry.method === method)
|
|
19415
19591
|
);
|
|
@@ -19436,9 +19612,10 @@ function createMcpJamMcpServer(options) {
|
|
|
19436
19612
|
inputSchema: z.object(targetConfigFields),
|
|
19437
19613
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19438
19614
|
},
|
|
19439
|
-
async (input) => runTool(async () => {
|
|
19615
|
+
async (input) => runTool("server_doctor", async () => {
|
|
19440
19616
|
const { config, target } = buildTargetConfig(input, defaultTimeoutMs);
|
|
19441
19617
|
const result = await runServerDoctor({
|
|
19618
|
+
__suppressTelemetry: true,
|
|
19442
19619
|
config,
|
|
19443
19620
|
target: summarizeServerDoctorTarget(target, config),
|
|
19444
19621
|
timeout: input.timeoutMs ?? defaultTimeoutMs
|
|
@@ -19459,7 +19636,7 @@ function createMcpJamMcpServer(options) {
|
|
|
19459
19636
|
}),
|
|
19460
19637
|
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
19461
19638
|
},
|
|
19462
|
-
async ({ url, accessToken, headers, timeoutMs }) => runTool(async () => {
|
|
19639
|
+
async ({ url, accessToken, headers, timeoutMs }) => runTool("probe_server", async () => {
|
|
19463
19640
|
assertHttpUrl(url);
|
|
19464
19641
|
const result = await probeMcpServer({
|
|
19465
19642
|
url,
|
|
@@ -19492,11 +19669,15 @@ function registerMcpCommands(program) {
|
|
|
19492
19669
|
const globalOptions = getGlobalOptions(command);
|
|
19493
19670
|
const handle = createMcpJamMcpServer({
|
|
19494
19671
|
version: package_default.version,
|
|
19495
|
-
defaultTimeoutMs: globalOptions.timeout
|
|
19672
|
+
defaultTimeoutMs: globalOptions.timeout,
|
|
19673
|
+
onToolCalled: captureMcpToolEvent
|
|
19496
19674
|
});
|
|
19497
19675
|
const transport = new StdioServerTransport();
|
|
19498
19676
|
let resolveClosed;
|
|
19499
|
-
const stopOnSignal = () =>
|
|
19677
|
+
const stopOnSignal = () => {
|
|
19678
|
+
recordCommandOutcome("interrupted");
|
|
19679
|
+
resolveClosed();
|
|
19680
|
+
};
|
|
19500
19681
|
const closed = new Promise((resolve2) => {
|
|
19501
19682
|
resolveClosed = resolve2;
|
|
19502
19683
|
handle.server.server.onclose = resolve2;
|
|
@@ -19565,7 +19746,7 @@ function registerProtocolCommands(program) {
|
|
|
19565
19746
|
...config,
|
|
19566
19747
|
__suppressTelemetry: true
|
|
19567
19748
|
});
|
|
19568
|
-
captureConformanceRunEvent();
|
|
19749
|
+
captureConformanceRunEvent("protocol", "single");
|
|
19569
19750
|
const result = await test.run();
|
|
19570
19751
|
writeConformanceOutput2(renderConformanceForCli(result, reporter, format));
|
|
19571
19752
|
reportScore(scoreFromProtocolResult(result), command);
|
|
@@ -19598,7 +19779,7 @@ function registerProtocolCommands(program) {
|
|
|
19598
19779
|
...config,
|
|
19599
19780
|
__suppressTelemetry: true
|
|
19600
19781
|
});
|
|
19601
|
-
captureConformanceRunEvent();
|
|
19782
|
+
captureConformanceRunEvent("protocol", "suite");
|
|
19602
19783
|
const result = await suite.run();
|
|
19603
19784
|
writeConformanceOutput2(renderConformanceForCli(result, reporter, format));
|
|
19604
19785
|
for (const run of result.results) {
|
|
@@ -19735,13 +19916,13 @@ function resolveLogProbes(options) {
|
|
|
19735
19916
|
}
|
|
19736
19917
|
return { logProbe, logLevelFilteringProbe };
|
|
19737
19918
|
}
|
|
19738
|
-
function readFixturesFile(
|
|
19919
|
+
function readFixturesFile(path14) {
|
|
19739
19920
|
let raw;
|
|
19740
19921
|
try {
|
|
19741
|
-
raw = readFileSync(
|
|
19922
|
+
raw = readFileSync(path14, "utf8");
|
|
19742
19923
|
} catch (error) {
|
|
19743
19924
|
throw usageError(
|
|
19744
|
-
`Could not read fixtures file ${
|
|
19925
|
+
`Could not read fixtures file ${path14}: ${error instanceof Error ? error.message : String(error)}`
|
|
19745
19926
|
);
|
|
19746
19927
|
}
|
|
19747
19928
|
let parsed;
|
|
@@ -19749,15 +19930,15 @@ function readFixturesFile(path12) {
|
|
|
19749
19930
|
parsed = JSON.parse(raw);
|
|
19750
19931
|
} catch (error) {
|
|
19751
19932
|
throw usageError(
|
|
19752
|
-
`Fixtures file ${
|
|
19933
|
+
`Fixtures file ${path14} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
19753
19934
|
);
|
|
19754
19935
|
}
|
|
19755
19936
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
19756
19937
|
throw usageError(
|
|
19757
|
-
`Fixtures file ${
|
|
19938
|
+
`Fixtures file ${path14} must contain a JSON object with toolCalls and/or promptGets`
|
|
19758
19939
|
);
|
|
19759
19940
|
}
|
|
19760
|
-
validateFixtures(parsed, `Fixtures file ${
|
|
19941
|
+
validateFixtures(parsed, `Fixtures file ${path14}`);
|
|
19761
19942
|
const document = parsed;
|
|
19762
19943
|
return {
|
|
19763
19944
|
toolCalls: document.toolCalls ?? [],
|
|
@@ -20148,7 +20329,7 @@ function registerOAuthCommands(program) {
|
|
|
20148
20329
|
...config,
|
|
20149
20330
|
__suppressTelemetry: true
|
|
20150
20331
|
});
|
|
20151
|
-
captureConformanceRunEvent();
|
|
20332
|
+
captureConformanceRunEvent("oauth", "single");
|
|
20152
20333
|
const result = await test.run();
|
|
20153
20334
|
let credentialsFilePath;
|
|
20154
20335
|
let credentialsFileError;
|
|
@@ -20226,7 +20407,7 @@ function registerOAuthCommands(program) {
|
|
|
20226
20407
|
...config,
|
|
20227
20408
|
__suppressTelemetry: true
|
|
20228
20409
|
});
|
|
20229
|
-
captureConformanceRunEvent();
|
|
20410
|
+
captureConformanceRunEvent("oauth", "suite");
|
|
20230
20411
|
const result = await suite.run();
|
|
20231
20412
|
const credentialsResultIndex = findCredentialsResultIndex(result);
|
|
20232
20413
|
let credentialsFilePath;
|
|
@@ -21068,7 +21249,7 @@ async function runTaskVerb(options, command, fn, verbOptions = {}) {
|
|
|
21068
21249
|
const globalOptions = getGlobalOptions(command);
|
|
21069
21250
|
const taskId = verbOptions.requiresTaskId === false ? "" : requireTaskId(options);
|
|
21070
21251
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: describeTarget(options) }) : void 0;
|
|
21071
|
-
const
|
|
21252
|
+
const note2 = (message) => {
|
|
21072
21253
|
if (!globalOptions.quiet) process.stderr.write(`${message}
|
|
21073
21254
|
`);
|
|
21074
21255
|
};
|
|
@@ -21077,7 +21258,7 @@ async function runTaskVerb(options, command, fn, verbOptions = {}) {
|
|
|
21077
21258
|
config,
|
|
21078
21259
|
async (manager, serverId) => {
|
|
21079
21260
|
const support = resolveTasksSupportOrThrow(manager, serverId, options.wire);
|
|
21080
|
-
return fn({ manager, serverId, support, taskId, globalOptions, note });
|
|
21261
|
+
return fn({ manager, serverId, support, taskId, globalOptions, note: note2 });
|
|
21081
21262
|
},
|
|
21082
21263
|
{ timeout: globalOptions.timeout, rpcLogger: collector?.rpcLogger }
|
|
21083
21264
|
);
|
|
@@ -21126,9 +21307,9 @@ function registerTaskVerbs(tasks) {
|
|
|
21126
21307
|
(options, command) => runTaskVerb(
|
|
21127
21308
|
options,
|
|
21128
21309
|
command,
|
|
21129
|
-
async ({ manager, serverId, support, note }) => {
|
|
21310
|
+
async ({ manager, serverId, support, note: note2 }) => {
|
|
21130
21311
|
if (support.wire === "extension") {
|
|
21131
|
-
|
|
21312
|
+
note2(
|
|
21132
21313
|
"Note: SEP-2663 removed tasks/list \u2014 a server cannot enumerate tasks for you on the extension wire, so this is always empty. Track task ids from `tools call --task` instead."
|
|
21133
21314
|
);
|
|
21134
21315
|
} else {
|
|
@@ -21198,7 +21379,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21198
21379
|
(options, command) => runTaskVerb(
|
|
21199
21380
|
options,
|
|
21200
21381
|
command,
|
|
21201
|
-
async ({ manager, serverId, support, taskId, note }) => {
|
|
21382
|
+
async ({ manager, serverId, support, taskId, note: note2 }) => {
|
|
21202
21383
|
assertWireCapability(
|
|
21203
21384
|
support,
|
|
21204
21385
|
"cancel",
|
|
@@ -21207,7 +21388,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21207
21388
|
try {
|
|
21208
21389
|
if (support.wire === "extension") {
|
|
21209
21390
|
await manager.cancelTaskExt(serverId, taskId);
|
|
21210
|
-
|
|
21391
|
+
note2(
|
|
21211
21392
|
"Cancellation requested. SEP-2663 cancellation is cooperative and the ack is empty: the task may still be running, and may still reach `completed`. Re-poll with `mcpjam tasks get`."
|
|
21212
21393
|
);
|
|
21213
21394
|
return { wire: support.wire, task: null, cooperative: true };
|
|
@@ -21236,7 +21417,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21236
21417
|
(options, command) => runTaskVerb(
|
|
21237
21418
|
options,
|
|
21238
21419
|
command,
|
|
21239
|
-
async ({ manager, serverId, support, taskId, note }) => {
|
|
21420
|
+
async ({ manager, serverId, support, taskId, note: note2 }) => {
|
|
21240
21421
|
assertWireCapability(
|
|
21241
21422
|
support,
|
|
21242
21423
|
"update",
|
|
@@ -21258,7 +21439,7 @@ function registerTaskVerbs(tasks) {
|
|
|
21258
21439
|
taskId,
|
|
21259
21440
|
responses
|
|
21260
21441
|
);
|
|
21261
|
-
|
|
21442
|
+
note2(
|
|
21262
21443
|
"Responses accepted. The ack is empty by design \u2014 the task's status does not move until a later `mcpjam tasks get`."
|
|
21263
21444
|
);
|
|
21264
21445
|
return { wire: support.wire, ack };
|
|
@@ -21308,7 +21489,10 @@ function taskWatchTuningFrom(options) {
|
|
|
21308
21489
|
}
|
|
21309
21490
|
async function withWatchSignals(fn) {
|
|
21310
21491
|
const controller = new AbortController();
|
|
21311
|
-
const onSignal = () =>
|
|
21492
|
+
const onSignal = () => {
|
|
21493
|
+
recordCommandOutcome("interrupted");
|
|
21494
|
+
controller.abort();
|
|
21495
|
+
};
|
|
21312
21496
|
process.on("SIGINT", onSignal);
|
|
21313
21497
|
process.on("SIGTERM", onSignal);
|
|
21314
21498
|
try {
|
|
@@ -21474,7 +21658,7 @@ function registerTasksCommands(program) {
|
|
|
21474
21658
|
...config,
|
|
21475
21659
|
__suppressTelemetry: true
|
|
21476
21660
|
});
|
|
21477
|
-
captureConformanceRunEvent();
|
|
21661
|
+
captureConformanceRunEvent("tasks", "single");
|
|
21478
21662
|
const result = await test.run();
|
|
21479
21663
|
const outputResult = reporter ? result : withRpcLogsIfRequested(result, collector, {
|
|
21480
21664
|
format,
|
|
@@ -21614,8 +21798,8 @@ function registerConformanceRunCommand(program) {
|
|
|
21614
21798
|
...oauthReadinessIds ? { readinessIds: oauthReadinessIds } : {}
|
|
21615
21799
|
};
|
|
21616
21800
|
}
|
|
21617
|
-
captureConformanceRunEvent();
|
|
21618
|
-
const
|
|
21801
|
+
captureConformanceRunEvent("run", "suite");
|
|
21802
|
+
const report2 = await runConformance({
|
|
21619
21803
|
server,
|
|
21620
21804
|
suites,
|
|
21621
21805
|
oauth,
|
|
@@ -21638,11 +21822,11 @@ function registerConformanceRunCommand(program) {
|
|
|
21638
21822
|
});
|
|
21639
21823
|
if (reporter === "junit-xml") {
|
|
21640
21824
|
const { renderConformanceRunJUnitXml } = await import('@mcpjam/sdk');
|
|
21641
|
-
writeConformanceOutput3(renderConformanceRunJUnitXml(
|
|
21825
|
+
writeConformanceOutput3(renderConformanceRunJUnitXml(report2));
|
|
21642
21826
|
} else if (reporter === "json-summary" || format === "json") {
|
|
21643
|
-
writeConformanceOutput3(JSON.stringify(
|
|
21827
|
+
writeConformanceOutput3(JSON.stringify(report2, null, 2));
|
|
21644
21828
|
} else {
|
|
21645
|
-
for (const [kind, suiteReport] of Object.entries(
|
|
21829
|
+
for (const [kind, suiteReport] of Object.entries(report2.reports)) {
|
|
21646
21830
|
process.stderr.write(`
|
|
21647
21831
|
== ${kind} ==
|
|
21648
21832
|
`);
|
|
@@ -21651,20 +21835,20 @@ function registerConformanceRunCommand(program) {
|
|
|
21651
21835
|
);
|
|
21652
21836
|
}
|
|
21653
21837
|
}
|
|
21654
|
-
reportScore(
|
|
21655
|
-
for (const suiteReport of Object.values(
|
|
21838
|
+
reportScore(report2.score, command);
|
|
21839
|
+
for (const suiteReport of Object.values(report2.reports)) {
|
|
21656
21840
|
reportIncomplete(suiteReport, command);
|
|
21657
21841
|
}
|
|
21658
21842
|
if (uploads(options)) {
|
|
21659
|
-
await uploadConformanceReport(
|
|
21843
|
+
await uploadConformanceReport(report2, {
|
|
21660
21844
|
serverUrl: String(server.url),
|
|
21661
21845
|
requireUpload: options.requireUpload === true,
|
|
21662
21846
|
command
|
|
21663
21847
|
});
|
|
21664
21848
|
}
|
|
21665
21849
|
const exitCode = conformanceExitCode({
|
|
21666
|
-
passed:
|
|
21667
|
-
outcome:
|
|
21850
|
+
passed: report2.outcome === "passed",
|
|
21851
|
+
outcome: report2.outcome
|
|
21668
21852
|
});
|
|
21669
21853
|
if (exitCode !== 0) {
|
|
21670
21854
|
setProcessExitCode(exitCode);
|
|
@@ -21955,6 +22139,1256 @@ function hostedLazyAuthFields(options) {
|
|
|
21955
22139
|
...claims ? { claimedFeatures: claims } : {}
|
|
21956
22140
|
};
|
|
21957
22141
|
}
|
|
22142
|
+
function parseGateChange(options, submission) {
|
|
22143
|
+
const failOn = options.failOn.map((check) => check.trim());
|
|
22144
|
+
const warnOnly = options.warnOnly.map((check) => check.trim());
|
|
22145
|
+
if (failOn.length === 0 && warnOnly.length === 0 && !options.clear) {
|
|
22146
|
+
throw usageError("Nothing to change. Pass --fail-on, --warn-only or --clear.");
|
|
22147
|
+
}
|
|
22148
|
+
const both = failOn.find((check) => warnOnly.includes(check));
|
|
22149
|
+
if (both !== void 0) {
|
|
22150
|
+
throw usageError(`${both} is given to both --fail-on and --warn-only. Pass it to one of them.`);
|
|
22151
|
+
}
|
|
22152
|
+
const probe = { submission, checkGate: { failOn, warnOnly } };
|
|
22153
|
+
const parsed = updateDirectorySubmissionOperation.inputSchema.safeParse(probe);
|
|
22154
|
+
if (!parsed.success) {
|
|
22155
|
+
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`);
|
|
22156
|
+
throw usageError(issues.join("; "));
|
|
22157
|
+
}
|
|
22158
|
+
return { failOn, warnOnly, clear: options.clear === true };
|
|
22159
|
+
}
|
|
22160
|
+
function nextGate(current, change) {
|
|
22161
|
+
const failOn = new Set(change.clear ? [] : current?.failOn);
|
|
22162
|
+
const warnOnly = new Set(change.clear ? [] : current?.warnOnly);
|
|
22163
|
+
for (const check of change.failOn) {
|
|
22164
|
+
failOn.add(check);
|
|
22165
|
+
warnOnly.delete(check);
|
|
22166
|
+
}
|
|
22167
|
+
for (const check of change.warnOnly) {
|
|
22168
|
+
warnOnly.add(check);
|
|
22169
|
+
failOn.delete(check);
|
|
22170
|
+
}
|
|
22171
|
+
if (failOn.size === 0 && warnOnly.size === 0) return null;
|
|
22172
|
+
return {
|
|
22173
|
+
...failOn.size > 0 ? { failOn: [...failOn] } : {},
|
|
22174
|
+
...warnOnly.size > 0 ? { warnOnly: [...warnOnly] } : {}
|
|
22175
|
+
};
|
|
22176
|
+
}
|
|
22177
|
+
async function saveGate(scope, change, context) {
|
|
22178
|
+
const { submission } = await getDirectorySubmissionOperation.execute(scope, context);
|
|
22179
|
+
const checkGate = nextGate(submission.checkGate, change);
|
|
22180
|
+
const input = { ...scope, checkGate, expectedRevision: submission.revision };
|
|
22181
|
+
try {
|
|
22182
|
+
return await updateDirectorySubmissionOperation.execute(input, context);
|
|
22183
|
+
} catch (error) {
|
|
22184
|
+
const conflict = directorySubmissionConflict(error);
|
|
22185
|
+
if (!conflict) throw error;
|
|
22186
|
+
throw new CliError(
|
|
22187
|
+
"CONFLICT",
|
|
22188
|
+
"This submission's check gate changed while yours was saving. Run the command again to apply your change to the new gate.",
|
|
22189
|
+
1,
|
|
22190
|
+
{
|
|
22191
|
+
currentRevision: conflict.currentRevision,
|
|
22192
|
+
conflictingKeys: conflict.conflictingKeys,
|
|
22193
|
+
checkGate: conflict.current?.checkGate ?? null
|
|
22194
|
+
}
|
|
22195
|
+
);
|
|
22196
|
+
}
|
|
22197
|
+
}
|
|
22198
|
+
function report(command, lines) {
|
|
22199
|
+
if (command.optsWithGlobals().quiet) return;
|
|
22200
|
+
process.stderr.write(`${lines.join("\n")}
|
|
22201
|
+
`);
|
|
22202
|
+
}
|
|
22203
|
+
function gateLines(gate) {
|
|
22204
|
+
const lines = ["Gate: the directory's blocking checks"];
|
|
22205
|
+
if (gate?.failOn?.length) lines.push(` Also fail on: ${gate.failOn.join(", ")}`);
|
|
22206
|
+
if (gate?.warnOnly?.length) lines.push(` Warn only: ${gate.warnOnly.join(", ")}`);
|
|
22207
|
+
return lines;
|
|
22208
|
+
}
|
|
22209
|
+
function reportGate(gate, command) {
|
|
22210
|
+
report(command, gateLines(gate));
|
|
22211
|
+
}
|
|
22212
|
+
function verdictSummary(results) {
|
|
22213
|
+
const { verdict, failing, undetermined } = results.verdict;
|
|
22214
|
+
if (verdict === "ready") return void 0;
|
|
22215
|
+
if (verdict === "not-ready") return `checks in the gate failed: ${failing.join(", ")}`;
|
|
22216
|
+
if (results.run === null) {
|
|
22217
|
+
return `no run has completed. Start one with \`mcpjam readiness submission run ${results.submissionId} --wait\`.`;
|
|
22218
|
+
}
|
|
22219
|
+
return undetermined.length > 0 ? `checks in the gate have no current result: ${undetermined.join(", ")}` : "the run reported no check in the gate";
|
|
22220
|
+
}
|
|
22221
|
+
function judgeResults(results, command) {
|
|
22222
|
+
const { verdict } = results;
|
|
22223
|
+
reportReadinessVerdict({ status: verdict.verdict, summary: verdictSummary(results) }, command);
|
|
22224
|
+
const skipped = verdict.notCheckedOnPath.map(
|
|
22225
|
+
(check) => ` ${check}: ${verdict.notCheckedReasons[check]}`
|
|
22226
|
+
);
|
|
22227
|
+
report(command, [
|
|
22228
|
+
...gateLines(verdict.gate),
|
|
22229
|
+
...skipped.length > 0 ? [`Not checked on hosted runs (${skipped.length}):`, ...skipped] : []
|
|
22230
|
+
]);
|
|
22231
|
+
setProcessExitCode(directoryReadinessExitCode({ status: verdict.verdict }));
|
|
22232
|
+
}
|
|
22233
|
+
async function withVerdictExit(action) {
|
|
22234
|
+
try {
|
|
22235
|
+
await action();
|
|
22236
|
+
} catch (error) {
|
|
22237
|
+
if (!(error instanceof CliError) || error.exitCode === 2) throw error;
|
|
22238
|
+
throw new CliError(error.code, error.message, 3, error.details);
|
|
22239
|
+
}
|
|
22240
|
+
}
|
|
22241
|
+
|
|
22242
|
+
// src/lib/op-bindings.ts
|
|
22243
|
+
var CLI_BINDINGS = {
|
|
22244
|
+
// ── Organizations ───────────────────────────────────────────────────────
|
|
22245
|
+
// Read-only, and the only organization command there is. Member, role,
|
|
22246
|
+
// invite and billing writes are account administration and stay in the app.
|
|
22247
|
+
list_organizations: { command: "cloud organizations list" },
|
|
22248
|
+
// ── Projects and servers ────────────────────────────────────────────────
|
|
22249
|
+
list_projects: { command: "cloud projects list" },
|
|
22250
|
+
create_project: { command: "cloud projects create" },
|
|
22251
|
+
update_project: { command: "cloud projects update" },
|
|
22252
|
+
delete_project: { command: "cloud projects delete" },
|
|
22253
|
+
list_project_servers: { command: "cloud projects servers" },
|
|
22254
|
+
create_project_server: { command: "cloud projects servers add" },
|
|
22255
|
+
connect_project_server: { command: "cloud projects servers connect" },
|
|
22256
|
+
// Its OWN command, not `servers connect`. `connect` does poll this operation
|
|
22257
|
+
// while it waits, but `--no-wait` and Ctrl-C both hand back a request id, and
|
|
22258
|
+
// pointing the binding at `connect` claimed a command that could not follow
|
|
22259
|
+
// one — re-running `connect` starts a second request rather than reading the
|
|
22260
|
+
// first.
|
|
22261
|
+
get_project_server_connection_status: {
|
|
22262
|
+
command: "cloud projects servers connect-status"
|
|
22263
|
+
},
|
|
22264
|
+
cancel_project_server_connection: {
|
|
22265
|
+
command: "cloud projects servers connect-cancel"
|
|
22266
|
+
},
|
|
22267
|
+
get_project_server: { command: "cloud projects servers get" },
|
|
22268
|
+
list_server_revisions: { command: "cloud projects servers revisions" },
|
|
22269
|
+
get_server_revision: { command: "cloud projects servers revision" },
|
|
22270
|
+
diff_server_revisions: { command: "cloud projects servers revision-diff" },
|
|
22271
|
+
// `default` runs the same operation as `rename`, with `isDefault` in place
|
|
22272
|
+
// of a name.
|
|
22273
|
+
list_server_accounts: { command: "cloud server-accounts list" },
|
|
22274
|
+
get_server_account: { command: "cloud server-accounts show" },
|
|
22275
|
+
upload_server_account_tokens: { command: "cloud server-accounts set" },
|
|
22276
|
+
update_server_account: { command: "cloud server-accounts rename" },
|
|
22277
|
+
delete_server_account: { command: "cloud server-accounts delete" },
|
|
22278
|
+
update_project_server: { command: "cloud projects servers update" },
|
|
22279
|
+
delete_project_server: { command: "cloud projects servers remove" },
|
|
22280
|
+
show_servers: { command: "cloud projects status" },
|
|
22281
|
+
// ── Journeys (the Swarms product) ───────────────────────────────────────
|
|
22282
|
+
// Flag-gated beta. Bound normally rather than excluded: the server returns a
|
|
22283
|
+
// clean "not currently available for your organization" when the flag is off,
|
|
22284
|
+
// which is a better answer than a command that does not exist. Same shape as
|
|
22285
|
+
// `environments` and `images` for an org that lacks those.
|
|
22286
|
+
list_goals: { command: "cloud goals list" },
|
|
22287
|
+
list_goal_runs: { command: "cloud goals runs" },
|
|
22288
|
+
get_goal_run: { command: "cloud goals status" },
|
|
22289
|
+
list_goal_run_sessions: { command: "cloud goals sessions" },
|
|
22290
|
+
launch_goal_run: { command: "cloud goals run" },
|
|
22291
|
+
cancel_goal_run: { command: "cloud goals cancel" },
|
|
22292
|
+
// Authoring + insights, in `commands/swarms.ts` but hung off the same
|
|
22293
|
+
// `journeys` group so `journeys run` and `journeys create` are one surface
|
|
22294
|
+
// to the person typing them.
|
|
22295
|
+
get_goal: { command: "cloud goals get" },
|
|
22296
|
+
create_goal: { command: "cloud goals create" },
|
|
22297
|
+
update_goal: { command: "cloud goals update" },
|
|
22298
|
+
archive_goal: { command: "cloud goals archive" },
|
|
22299
|
+
generate_goals: { command: "cloud goals generate" },
|
|
22300
|
+
get_swarms_overview: { command: "cloud goals overview" },
|
|
22301
|
+
get_goal_run_scorecard: { command: "cloud goals scorecard" },
|
|
22302
|
+
list_swarm_findings: { command: "cloud goals findings" },
|
|
22303
|
+
dismiss_swarm_finding: { command: "cloud goals dismiss-finding" },
|
|
22304
|
+
undismiss_swarm_finding: { command: "cloud goals undismiss-finding" },
|
|
22305
|
+
get_swarm_run_insights: { command: "cloud goals insights" },
|
|
22306
|
+
request_swarm_run_insights: { command: "cloud goals request-insights" },
|
|
22307
|
+
cancel_swarm_run_insights: { command: "cloud goals cancel-insights" },
|
|
22308
|
+
// ── Personas and swarm containers (Swarms authoring) ────────────────────
|
|
22309
|
+
list_personas: { command: "cloud personas list" },
|
|
22310
|
+
get_persona: { command: "cloud personas get" },
|
|
22311
|
+
create_persona: { command: "cloud personas create" },
|
|
22312
|
+
update_persona: { command: "cloud personas update" },
|
|
22313
|
+
delete_persona: { command: "cloud personas delete" },
|
|
22314
|
+
generate_personas: { command: "cloud personas generate" },
|
|
22315
|
+
// ── Project secrets ─────────────────────────────────────────────────────
|
|
22316
|
+
// `set`/`update` take the value from --value-file, --value-env, or stdin.
|
|
22317
|
+
// A positional value would be written to shell history and visible in `ps`
|
|
22318
|
+
// for the life of the command, which is why the CLI does not offer one.
|
|
22319
|
+
list_secrets: { command: "cloud secrets list" },
|
|
22320
|
+
get_secret: { command: "cloud secrets show" },
|
|
22321
|
+
create_secret: { command: "cloud secrets set" },
|
|
22322
|
+
update_secret: { command: "cloud secrets update" },
|
|
22323
|
+
delete_secret: { command: "cloud secrets rm" },
|
|
22324
|
+
// ── Trace destinations ──────────────────────────────────────────────────
|
|
22325
|
+
// The full surface, bound rather than excluded. Availability is decided per
|
|
22326
|
+
// organization and the server answers a de-flagged org with a clean refusal,
|
|
22327
|
+
// which is a better answer than a command that does not exist — the same
|
|
22328
|
+
// reasoning `journeys` states above. A CLI binding is what makes this
|
|
22329
|
+
// scriptable from CI, which is where an observability integration is
|
|
22330
|
+
// configured in the first place.
|
|
22331
|
+
list_trace_destinations: { command: "cloud trace-destinations list" },
|
|
22332
|
+
get_trace_destination: { command: "cloud trace-destinations show" },
|
|
22333
|
+
create_trace_destination: { command: "cloud trace-destinations create" },
|
|
22334
|
+
update_trace_destination: { command: "cloud trace-destinations update" },
|
|
22335
|
+
delete_trace_destination: { command: "cloud trace-destinations rm" },
|
|
22336
|
+
test_trace_destination: { command: "cloud trace-destinations test" },
|
|
22337
|
+
pause_trace_destination: { command: "cloud trace-destinations pause" },
|
|
22338
|
+
resume_trace_destination: { command: "cloud trace-destinations resume" },
|
|
22339
|
+
backfill_trace_destination: { command: "cloud trace-destinations backfill" },
|
|
22340
|
+
list_trace_destination_backfills: {
|
|
22341
|
+
command: "cloud trace-destinations backfills"
|
|
22342
|
+
},
|
|
22343
|
+
list_swarms: { command: "cloud swarms list" },
|
|
22344
|
+
get_swarm: { command: "cloud swarms get" },
|
|
22345
|
+
create_swarm: { command: "cloud swarms create" },
|
|
22346
|
+
update_swarm: { command: "cloud swarms update" },
|
|
22347
|
+
archive_swarm: { command: "cloud swarms archive" },
|
|
22348
|
+
// ── Capabilities ────────────────────────────────────────────────────────
|
|
22349
|
+
// Nested under projects: the answer is project-scoped (role, org betas,
|
|
22350
|
+
// plan limits) even though it spans Swarms, user testing, and the plan.
|
|
22351
|
+
get_capabilities: { command: "cloud projects capabilities" },
|
|
22352
|
+
// ── Scenarios (user testing) ────────────────────────────────────────────
|
|
22353
|
+
// Publishing and taking down. The reads (`scenarios list` / `scenarios get`)
|
|
22354
|
+
// are bound under "Chat surfaces" below — they used to be a separate group
|
|
22355
|
+
// under the product's older name, and now share this one command.
|
|
22356
|
+
publish_study: { command: "cloud studies publish" },
|
|
22357
|
+
unpublish_study: { command: "cloud studies unpublish" },
|
|
22358
|
+
// ── User testing: everything you do with a scenario once it exists ──────
|
|
22359
|
+
get_study: { command: "cloud studies get" },
|
|
22360
|
+
update_study: { command: "cloud studies update" },
|
|
22361
|
+
list_study_sessions: { command: "cloud studies sessions" },
|
|
22362
|
+
get_study_session: { command: "cloud studies session" },
|
|
22363
|
+
get_study_metrics: { command: "cloud studies metrics" },
|
|
22364
|
+
get_study_usage: { command: "cloud studies usage" },
|
|
22365
|
+
list_study_findings: { command: "cloud studies findings" },
|
|
22366
|
+
get_study_signals: { command: "cloud studies signals" },
|
|
22367
|
+
get_study_insights: { command: "cloud studies insights" },
|
|
22368
|
+
request_study_insights: {
|
|
22369
|
+
command: "cloud studies request-insights"
|
|
22370
|
+
},
|
|
22371
|
+
cancel_study_insights: {
|
|
22372
|
+
command: "cloud studies cancel-insights"
|
|
22373
|
+
},
|
|
22374
|
+
dismiss_study_finding: {
|
|
22375
|
+
command: "cloud studies dismiss-finding"
|
|
22376
|
+
},
|
|
22377
|
+
undismiss_study_finding: {
|
|
22378
|
+
command: "cloud studies undismiss-finding"
|
|
22379
|
+
},
|
|
22380
|
+
set_study_guest_execution: {
|
|
22381
|
+
command: "cloud studies guest-execution"
|
|
22382
|
+
},
|
|
22383
|
+
rotate_study_link: { command: "cloud studies rotate-link" },
|
|
22384
|
+
upsert_study_member: { command: "cloud studies invite" },
|
|
22385
|
+
remove_study_member: { command: "cloud studies remove-member" },
|
|
22386
|
+
rebind_study: { command: "cloud studies rebind" },
|
|
22387
|
+
// Unified share. I5 shipped SDK/MCP/agent; there is no `cloud share`
|
|
22388
|
+
// command yet. Exclude until one exists — a binding with no Commander path
|
|
22389
|
+
// fails the tree test.
|
|
22390
|
+
get_share_settings: {
|
|
22391
|
+
excluded: "Share settings are read from the Share dialog; no `cloud share` command exists yet."
|
|
22392
|
+
},
|
|
22393
|
+
set_share_mode: {
|
|
22394
|
+
excluded: "Changing who can open a shared resource is confirmed in the Share dialog; no CLI write exists yet."
|
|
22395
|
+
},
|
|
22396
|
+
rotate_share_link: {
|
|
22397
|
+
excluded: "Rotating a unified share URL is irreversible and confirmed in the UI; no CLI command exists yet."
|
|
22398
|
+
},
|
|
22399
|
+
// ── Evals ───────────────────────────────────────────────────────────────
|
|
22400
|
+
list_eval_suites: { command: "cloud eval list" },
|
|
22401
|
+
create_eval_suite: { command: "cloud eval create" },
|
|
22402
|
+
get_eval_suite: { command: "cloud eval get" },
|
|
22403
|
+
get_eval_run_disclosure: {
|
|
22404
|
+
excluded: "Not a standalone command: `cloud eval run` already fetches this for its frozen launch plan and prints it (writeRunDisclosure) before the run link in human mode \u2014 on stderr instead of stdout when a --reporter is configured, so the structured report stays the sole document on stdout without losing the disclosure entirely \u2014 and carries it on the JSON receipt's `disclosure` field. A separate command would only invite checking by hand what the launch already discloses."
|
|
22405
|
+
},
|
|
22406
|
+
update_eval_suite: { command: "cloud eval update" },
|
|
22407
|
+
delete_eval_suite: { command: "cloud eval delete" },
|
|
22408
|
+
set_eval_suite_schedule: { command: "cloud eval schedule" },
|
|
22409
|
+
set_eval_suite_environments: { command: "cloud eval environments set" },
|
|
22410
|
+
list_eval_suite_runs: { command: "cloud eval runs" },
|
|
22411
|
+
list_eval_suite_revisions: { command: "cloud eval revisions" },
|
|
22412
|
+
run_eval_suite: { command: "cloud eval run" },
|
|
22413
|
+
cancel_eval_run: { command: "cloud eval cancel" },
|
|
22414
|
+
backtest_eval_run: { command: "cloud eval backtest" },
|
|
22415
|
+
backtest_eval_run_judge: { command: "cloud eval judge-backtest" },
|
|
22416
|
+
request_eval_run_judge: { command: "cloud eval judge" },
|
|
22417
|
+
list_eval_github_repos: { command: "cloud eval github list" },
|
|
22418
|
+
connect_eval_github_repo: { command: "cloud eval github connect" },
|
|
22419
|
+
// The pre-rename spellings, still advertised and still bound — to the
|
|
22420
|
+
// `checks` subgroup they shipped under, which stays registered as a
|
|
22421
|
+
// deprecated alias of `github`.
|
|
22422
|
+
list_eval_check_repos: { command: "cloud eval checks list" },
|
|
22423
|
+
connect_eval_check_repo: { command: "cloud eval checks connect" },
|
|
22424
|
+
get_eval_run: { command: "cloud eval status" },
|
|
22425
|
+
// BOTH bound to one command, addressed by `--run` XOR `--suite`. They are
|
|
22426
|
+
// the same document read two ways — one run, or a suite's runs as a trend
|
|
22427
|
+
// series — and two commands would leave a reader guessing which one
|
|
22428
|
+
// answers "has this stage got worse".
|
|
22429
|
+
//
|
|
22430
|
+
// FLAG-QUALIFIED, following the `registry install --card` precedent above:
|
|
22431
|
+
// the binding test resolves the flag against the real Commander tree, so
|
|
22432
|
+
// these entries prove each shelf exists. Unqualified, both would resolve to
|
|
22433
|
+
// the bare command and the test would still pass with `--run` deleted.
|
|
22434
|
+
get_eval_run_stage_analytics: {
|
|
22435
|
+
command: "cloud eval stage-analytics --run"
|
|
22436
|
+
},
|
|
22437
|
+
get_eval_run_gate: {
|
|
22438
|
+
command: "cloud eval gate --run"
|
|
22439
|
+
},
|
|
22440
|
+
get_eval_run_route_facts: { command: "cloud eval route-facts --run" },
|
|
22441
|
+
get_eval_run_server_facts: { command: "cloud eval server-facts --run" },
|
|
22442
|
+
propose_eval_description_rewrite: {
|
|
22443
|
+
command: "cloud eval description-experiment propose --run --tool"
|
|
22444
|
+
},
|
|
22445
|
+
start_eval_description_experiment: {
|
|
22446
|
+
command: "cloud eval description-experiment start --experiment"
|
|
22447
|
+
},
|
|
22448
|
+
get_eval_description_experiment: {
|
|
22449
|
+
command: "cloud eval description-experiment get --experiment"
|
|
22450
|
+
},
|
|
22451
|
+
list_eval_suite_stage_analytics: {
|
|
22452
|
+
command: "cloud eval stage-analytics --suite"
|
|
22453
|
+
},
|
|
22454
|
+
compare_eval_run: { command: "cloud eval compare" },
|
|
22455
|
+
waive_eval_gate: { command: "cloud eval gate waive" },
|
|
22456
|
+
revoke_eval_gate_waiver: { command: "cloud eval gate unwaive" },
|
|
22457
|
+
get_eval_gate_waiver: {
|
|
22458
|
+
excluded: "Not a standalone command: `cloud eval gate` already reads the waiver off the run projection and names it in every artifact it writes, and `gate unwaive` resolves the waiver in force when `--waiver` is omitted. A separate read command would only invite checking by hand what the gate already reports."
|
|
22459
|
+
},
|
|
22460
|
+
list_eval_run_iterations: { command: "cloud eval iterations" },
|
|
22461
|
+
get_eval_iteration_trace: { command: "cloud eval trace" },
|
|
22462
|
+
get_eval_run_steps: { command: "cloud eval steps" },
|
|
22463
|
+
list_eval_cases: { command: "cloud eval cases list" },
|
|
22464
|
+
get_eval_case: { command: "cloud eval cases get" },
|
|
22465
|
+
create_eval_case: { command: "cloud eval cases create" },
|
|
22466
|
+
create_eval_cases: { command: "cloud eval run --file" },
|
|
22467
|
+
update_eval_case: { command: "cloud eval cases update" },
|
|
22468
|
+
delete_eval_case: { command: "cloud eval cases delete" },
|
|
22469
|
+
generate_eval_cases: { command: "cloud eval cases generate" },
|
|
22470
|
+
import_eval_cases: { command: "cloud eval cases import" },
|
|
22471
|
+
run_eval_case: { command: "cloud eval cases run" },
|
|
22472
|
+
// ── Hosts, environments, images ─────────────────────────────────────────
|
|
22473
|
+
// `cloud clients …`, with `cloud hosts …` kept as a command alias so existing
|
|
22474
|
+
// scripts keep working. The binding names the CANONICAL path — the alias is
|
|
22475
|
+
// resolvable by the same Commander tree, and pointing the binding at it would
|
|
22476
|
+
// document the spelling we are moving away from.
|
|
22477
|
+
list_clients: { command: "cloud clients list" },
|
|
22478
|
+
get_client: { command: "cloud clients get" },
|
|
22479
|
+
create_client: { command: "cloud clients create" },
|
|
22480
|
+
update_client: { command: "cloud clients update" },
|
|
22481
|
+
delete_client: { command: "cloud clients delete" },
|
|
22482
|
+
set_client_servers: { command: "cloud clients servers" },
|
|
22483
|
+
duplicate_client: { command: "cloud clients duplicate" },
|
|
22484
|
+
list_project_environments: { command: "cloud environments list" },
|
|
22485
|
+
get_project_environment_capabilities: {
|
|
22486
|
+
excluded: "Not a user-facing command: it answers 'does this deployment accept a model override?', which `environments create --model` / `environments update --model|--clear-model` already ask on the caller's behalf before writing. A standalone command would only invite people to check by hand what the write already checks."
|
|
22487
|
+
},
|
|
22488
|
+
get_project_environment: { command: "cloud environments get" },
|
|
22489
|
+
resolve_project_environment: { command: "cloud environments resolve" },
|
|
22490
|
+
create_project_environment: { command: "cloud environments create" },
|
|
22491
|
+
ensure_adhoc_environment: { command: "cloud environments ensure-adhoc" },
|
|
22492
|
+
name_environment: { command: "cloud environments name" },
|
|
22493
|
+
update_project_environment: { command: "cloud environments update" },
|
|
22494
|
+
archive_project_environment: { command: "cloud environments archive" },
|
|
22495
|
+
restore_project_environment: { command: "cloud environments restore" },
|
|
22496
|
+
list_project_plugins: {
|
|
22497
|
+
excluded: "No `plugins` command group yet \u2014 the read surface shipped for the MCP catalog and API first. Bind both plugin reads together when the CLI grows one."
|
|
22498
|
+
},
|
|
22499
|
+
get_plugin_version: {
|
|
22500
|
+
excluded: "No `plugins` command group yet \u2014 the read surface shipped for the MCP catalog and API first. Bind both plugin reads together when the CLI grows one."
|
|
22501
|
+
},
|
|
22502
|
+
list_project_skills: { command: "cloud skills list" },
|
|
22503
|
+
get_project_skill: { command: "cloud skills get" },
|
|
22504
|
+
list_sandbox_images: { command: "cloud images list" },
|
|
22505
|
+
get_sandbox_image: { command: "cloud images get" },
|
|
22506
|
+
create_sandbox_image: { command: "cloud images create" },
|
|
22507
|
+
update_sandbox_image: { command: "cloud images edit" },
|
|
22508
|
+
validate_sandbox_image_blueprint: { command: "cloud images validate" },
|
|
22509
|
+
build_sandbox_image: { command: "cloud images build" },
|
|
22510
|
+
list_sandbox_image_builds: { command: "cloud images logs" },
|
|
22511
|
+
promote_sandbox_image: { command: "cloud images promote" },
|
|
22512
|
+
use_sandbox_image: { command: "cloud images use" },
|
|
22513
|
+
delete_sandbox_image: { command: "cloud images delete" },
|
|
22514
|
+
reset_computer: { command: "cloud images reset" },
|
|
22515
|
+
// ── Chat surfaces ───────────────────────────────────────────────────────
|
|
22516
|
+
list_studies: { command: "cloud studies list" },
|
|
22517
|
+
list_chat_sessions: { command: "cloud sessions list" },
|
|
22518
|
+
search_sessions: { command: "cloud sessions search" },
|
|
22519
|
+
send_chat_message: { command: "cloud sessions send" },
|
|
22520
|
+
drive_chat_session_browser: { command: "cloud sessions browser open" },
|
|
22521
|
+
observe_chat_session_browser: { command: "cloud sessions browser observe" },
|
|
22522
|
+
get_chat_session: { command: "cloud sessions show" },
|
|
22523
|
+
get_chat_session_trace: { command: "cloud sessions trace" },
|
|
22524
|
+
// ── Tunnels ─────────────────────────────────────────────────────────────
|
|
22525
|
+
create_tunnel: { command: "cloud tunnel" },
|
|
22526
|
+
close_tunnel: {
|
|
22527
|
+
excluded: "The tunnel closes when `mcpjam cloud tunnel` exits; a separate close command would only strand a session nobody is holding."
|
|
22528
|
+
},
|
|
22529
|
+
// ── Deliberately local-first ────────────────────────────────────────────
|
|
22530
|
+
// The CLI talks to MCP servers DIRECTLY (--url / config file) rather than
|
|
22531
|
+
// through the platform, so a developer can inspect a server that is not
|
|
22532
|
+
// saved in any project and without an API key. Routing these through the
|
|
22533
|
+
// hosted operations would make the platform a prerequisite for the CLI's
|
|
22534
|
+
// most common use. A hosted variant is a real feature request, not an
|
|
22535
|
+
// oversight — it would need its own `--project` mode.
|
|
22536
|
+
list_server_tools: {
|
|
22537
|
+
excluded: "`tools list` connects to the server directly, so it works without a project or an API key."
|
|
22538
|
+
},
|
|
22539
|
+
call_server_tool: {
|
|
22540
|
+
excluded: "`tools call` connects to the server directly, so it works without a project or an API key."
|
|
22541
|
+
},
|
|
22542
|
+
render_server_widget: {
|
|
22543
|
+
excluded: "`apps render` connects to the server directly and mounts the widget in the developer's OWN Chromium, so it works without a project or an API key \u2014 and spends no hosted browser to answer a question the local command already answers."
|
|
22544
|
+
},
|
|
22545
|
+
list_server_prompts: {
|
|
22546
|
+
excluded: "`prompts list` connects to the server directly, so it works without a project or an API key."
|
|
22547
|
+
},
|
|
22548
|
+
get_server_prompt: {
|
|
22549
|
+
excluded: "`prompts get` connects to the server directly, so it works without a project or an API key."
|
|
22550
|
+
},
|
|
22551
|
+
list_server_resources: {
|
|
22552
|
+
excluded: "`resources list` connects to the server directly, so it works without a project or an API key."
|
|
22553
|
+
},
|
|
22554
|
+
read_server_resource: {
|
|
22555
|
+
excluded: "`resources read` connects to the server directly, so it works without a project or an API key."
|
|
22556
|
+
},
|
|
22557
|
+
list_server_skills: {
|
|
22558
|
+
excluded: "`skills list` connects to the server directly, so it works without a project or an API key."
|
|
22559
|
+
},
|
|
22560
|
+
get_server_skill: {
|
|
22561
|
+
excluded: "`skills get` connects to the server directly, so it works without a project or an API key."
|
|
22562
|
+
},
|
|
22563
|
+
read_server_skill_file: {
|
|
22564
|
+
excluded: "`skills read` connects to the server directly, so it works without a project or an API key."
|
|
22565
|
+
},
|
|
22566
|
+
diagnose_server: {
|
|
22567
|
+
excluded: "`server doctor` runs the same sweep locally; the hosted variant is reachable through `projects status`."
|
|
22568
|
+
},
|
|
22569
|
+
validate_server: {
|
|
22570
|
+
excluded: "`server validate` runs locally against any reachable server, saved or not."
|
|
22571
|
+
},
|
|
22572
|
+
export_server: {
|
|
22573
|
+
excluded: "`server export` writes a snapshot of any reachable server without needing it saved first."
|
|
22574
|
+
},
|
|
22575
|
+
check_host_compatibility: {
|
|
22576
|
+
excluded: "`compat` evaluates the bundled catalog locally, so it stays fast and works offline."
|
|
22577
|
+
},
|
|
22578
|
+
// Directory readiness, hosted half. NOT excluded-citing-local like its
|
|
22579
|
+
// neighbours above: `readiness check` grades what THIS machine can reach,
|
|
22580
|
+
// and a hosted run grades the server as the platform reaches it, through the
|
|
22581
|
+
// saved row and the authorize exchange. Different questions, and only the
|
|
22582
|
+
// hosted one can spend for model observations or leave a record.
|
|
22583
|
+
start_claude_readiness_run: { command: "readiness start claude" },
|
|
22584
|
+
start_openai_readiness_run: { command: "readiness start openai" },
|
|
22585
|
+
start_muse_readiness_run: { command: "readiness start muse" },
|
|
22586
|
+
get_readiness_run: { command: "readiness status" },
|
|
22587
|
+
list_readiness_runs: { command: "readiness list" },
|
|
22588
|
+
cancel_readiness_run: { command: "readiness cancel" },
|
|
22589
|
+
resume_readiness_run: { command: "readiness resume" },
|
|
22590
|
+
get_readiness_report: { command: "readiness report" },
|
|
22591
|
+
// `readiness flows` lists the flows, or shows the one it is given.
|
|
22592
|
+
list_directory_flows: { command: "readiness flows" },
|
|
22593
|
+
get_directory_flow: { command: "readiness flows" },
|
|
22594
|
+
create_directory_submission: { command: "readiness submission create" },
|
|
22595
|
+
list_directory_submissions: { command: "readiness submission list" },
|
|
22596
|
+
get_directory_submission: { command: "readiness submission get" },
|
|
22597
|
+
// `readiness submission gate` runs it too, with only `checkGate`.
|
|
22598
|
+
update_directory_submission: { command: "readiness submission set" },
|
|
22599
|
+
delete_directory_submission: { command: "readiness submission delete" },
|
|
22600
|
+
start_directory_submission_run: { command: "readiness submission run" },
|
|
22601
|
+
get_directory_submission_results: {
|
|
22602
|
+
command: "readiness submission results"
|
|
22603
|
+
},
|
|
22604
|
+
// A submission's test plan; `readiness submission run --test-plan-revision`
|
|
22605
|
+
// starts a run that makes its calls.
|
|
22606
|
+
get_directory_submission_test_plan: { command: "readiness submission plan show" },
|
|
22607
|
+
draft_directory_submission_test_plan: { command: "readiness submission plan draft" },
|
|
22608
|
+
save_directory_submission_test_plan: { command: "readiness submission plan save" },
|
|
22609
|
+
get_directory_submission_tool_tests: { command: "readiness submission plan results" },
|
|
22610
|
+
// The eval suite holding a submission's test cases; `evals unlink` runs the
|
|
22611
|
+
// link too, with `null` for what it clears.
|
|
22612
|
+
get_directory_submission_evals: { command: "readiness submission evals show" },
|
|
22613
|
+
set_directory_submission_evals: { command: "readiness submission evals link" },
|
|
22614
|
+
import_directory_submission_test_cases: { command: "readiness submission evals import" },
|
|
22615
|
+
export_directory_submission_test_cases: { command: "readiness submission evals export" },
|
|
22616
|
+
// `readiness reviewer status` lists the attempts, or shows the one it is given.
|
|
22617
|
+
create_reviewer_attempt: { command: "readiness reviewer start" },
|
|
22618
|
+
list_reviewer_attempts: { command: "readiness reviewer status" },
|
|
22619
|
+
get_reviewer_attempt: { command: "readiness reviewer status" },
|
|
22620
|
+
create_reviewer_handoff: { command: "readiness reviewer handoff" },
|
|
22621
|
+
resume_reviewer_attempt: { command: "readiness reviewer resume" },
|
|
22622
|
+
cancel_reviewer_attempt: { command: "readiness reviewer cancel" },
|
|
22623
|
+
// Resuming a submission from its id, and recording what happened in the
|
|
22624
|
+
// directory itself.
|
|
22625
|
+
get_directory_submission_handoff: { command: "readiness submission handoff" },
|
|
22626
|
+
list_directory_submission_findings: {
|
|
22627
|
+
command: "readiness submission findings"
|
|
22628
|
+
},
|
|
22629
|
+
get_directory_submission_finding: { command: "readiness submission finding" },
|
|
22630
|
+
export_directory_submission: { command: "readiness submission export" },
|
|
22631
|
+
list_directory_submission_events: { command: "readiness submission events" },
|
|
22632
|
+
record_directory_submission_status: { command: "readiness submission status" },
|
|
22633
|
+
record_directory_submission_snapshot: {
|
|
22634
|
+
command: "readiness submission snapshot"
|
|
22635
|
+
},
|
|
22636
|
+
import_directory_finding: { command: "readiness submission import-finding" },
|
|
22637
|
+
// Hosted conformance, beside the local `mcpjam conformance` commands: those
|
|
22638
|
+
// grade what this machine reaches and record nothing in a project, these
|
|
22639
|
+
// run on the platform against a saved server and leave a run to poll.
|
|
22640
|
+
start_conformance_run: { command: "cloud conformance run" },
|
|
22641
|
+
get_conformance_run: { command: "cloud conformance status" },
|
|
22642
|
+
list_conformance_runs: { command: "cloud conformance runs" },
|
|
22643
|
+
get_conformance_report: { command: "cloud conformance report" },
|
|
22644
|
+
get_conformance_check: { command: "cloud conformance check" },
|
|
22645
|
+
// ── Covered by the surrounding session, not a command ────────────────────
|
|
22646
|
+
get_me: {
|
|
22647
|
+
excluded: "`cloud whoami` already reports the signed-in identity for the stored credentials."
|
|
22648
|
+
},
|
|
22649
|
+
list_models: {
|
|
22650
|
+
excluded: "Model choice belongs to whatever runs an eval; the CLI never picks one on the user's behalf."
|
|
22651
|
+
},
|
|
22652
|
+
search_registry_directory: { command: "registry search" },
|
|
22653
|
+
get_registry_directory_server: { command: "registry show" },
|
|
22654
|
+
list_registry_directory_sources: { command: "registry sources" },
|
|
22655
|
+
list_registry_servers: { command: "registry servers" },
|
|
22656
|
+
list_registry_connections: { command: "registry connections" },
|
|
22657
|
+
// One Commander path, two ops. `--card` is the shelf disambiguator;
|
|
22658
|
+
// the op-bindings test accepts a flag-qualified command string.
|
|
22659
|
+
install_registry_directory_server: { command: "registry install" },
|
|
22660
|
+
install_registry_server: { command: "registry install --card" },
|
|
22661
|
+
uninstall_registry_server: { command: "registry uninstall" },
|
|
22662
|
+
send_feedback: { command: "cloud feedback" }
|
|
22663
|
+
};
|
|
22664
|
+
|
|
22665
|
+
// src/commands/readiness-submission-handoff.ts
|
|
22666
|
+
var PAGE = 100;
|
|
22667
|
+
var EVIDENCE = "What shows it: url=<https link>, text=<quoted words> or run=<run id>";
|
|
22668
|
+
var scoped = (options, submission = "") => ({ project: options.project, submission });
|
|
22669
|
+
function checked(operation, input) {
|
|
22670
|
+
const parsed = operation.inputSchema.safeParse(input);
|
|
22671
|
+
if (parsed.success) return parsed.data;
|
|
22672
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
22673
|
+
}
|
|
22674
|
+
function note(command, lines) {
|
|
22675
|
+
if (lines.length > 0 && !command.optsWithGlobals().quiet) process.stderr.write(`${lines.join("\n")}
|
|
22676
|
+
`);
|
|
22677
|
+
}
|
|
22678
|
+
function verb(submission, name, description) {
|
|
22679
|
+
return addProjectOption(submission.command(name).description(description).argument("<submission>", "Submission id"));
|
|
22680
|
+
}
|
|
22681
|
+
function withJson(command) {
|
|
22682
|
+
return command.option("--json", "Print JSON (same as --format json)").hook("preAction", (self) => {
|
|
22683
|
+
if (self.opts().json) self.setOptionValue("format", "json");
|
|
22684
|
+
});
|
|
22685
|
+
}
|
|
22686
|
+
function runFor(command, execute) {
|
|
22687
|
+
const { timeout, quiet } = getGlobalOptions(command);
|
|
22688
|
+
const extras = { announce: false, quiet, command: `readiness submission ${command.name()}` };
|
|
22689
|
+
return runPlatformOperation(platformOptionsOf(command), timeout, execute, extras);
|
|
22690
|
+
}
|
|
22691
|
+
function nextSteps(actions) {
|
|
22692
|
+
const steps = actions.map(({ operation, why }) => {
|
|
22693
|
+
const binding = CLI_BINDINGS[operation];
|
|
22694
|
+
return ` ${binding && "command" in binding ? `mcpjam ${binding.command}` : operation}: ${why}`;
|
|
22695
|
+
});
|
|
22696
|
+
return steps.length > 0 ? ["Next:", ...steps] : [];
|
|
22697
|
+
}
|
|
22698
|
+
async function everyFinding(input, context, command) {
|
|
22699
|
+
const list = listDirectorySubmissionFindingsOperation;
|
|
22700
|
+
const first = await list.execute(input, context);
|
|
22701
|
+
const findings = [...first.findings];
|
|
22702
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22703
|
+
let cursor = first.nextCursor;
|
|
22704
|
+
while (cursor) {
|
|
22705
|
+
if (seen.has(cursor)) {
|
|
22706
|
+
const read = `${findings.length} findings`;
|
|
22707
|
+
throw operationalError(`The API sent the same findings page twice after ${read}. Run the command again.`);
|
|
22708
|
+
}
|
|
22709
|
+
seen.add(cursor);
|
|
22710
|
+
note(command, [`Read ${findings.length} findings. Reading the next page.`]);
|
|
22711
|
+
const page = await list.execute({ ...input, project: first.project.id, cursor }, context);
|
|
22712
|
+
findings.push(...page.findings);
|
|
22713
|
+
cursor = page.nextCursor;
|
|
22714
|
+
}
|
|
22715
|
+
return { project: first.project, submissionId: first.submissionId, findings };
|
|
22716
|
+
}
|
|
22717
|
+
async function savePack(out, filename, content) {
|
|
22718
|
+
const folder = statSync(out, { throwIfNoEntry: false })?.isDirectory();
|
|
22719
|
+
const target = folder ? path3.join(out, path3.basename(filename)) : out;
|
|
22720
|
+
try {
|
|
22721
|
+
return await writeFileAtomic(target, content, { createParents: true });
|
|
22722
|
+
} catch (error) {
|
|
22723
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22724
|
+
throw operationalError(`Could not save the pack to ${target} (${reason}). Pass another --out path.`);
|
|
22725
|
+
}
|
|
22726
|
+
}
|
|
22727
|
+
function evidenceOf(value) {
|
|
22728
|
+
if (value === void 0) return void 0;
|
|
22729
|
+
const split = value.indexOf("=");
|
|
22730
|
+
if (split <= 0) throw usageError("--evidence takes kind=value, such as url=https://example.com/status.");
|
|
22731
|
+
return { kind: value.slice(0, split), value: value.slice(split + 1) };
|
|
22732
|
+
}
|
|
22733
|
+
function epochOf(flag, value) {
|
|
22734
|
+
if (value === void 0) return void 0;
|
|
22735
|
+
const time = Date.parse(value);
|
|
22736
|
+
if (Number.isNaN(time)) throw usageError(`${flag} takes a date and time, such as 2026-11-13T09:30:00Z.`);
|
|
22737
|
+
return time;
|
|
22738
|
+
}
|
|
22739
|
+
function directoryWords({ textFile, text }) {
|
|
22740
|
+
if (textFile === void 0 === (text === void 0)) {
|
|
22741
|
+
throw usageError("Pass the directory's words with --text-file <path>, or pipe them in with --text -.");
|
|
22742
|
+
}
|
|
22743
|
+
if (text !== void 0 && text !== "-") {
|
|
22744
|
+
throw usageError("--text reads stdin only, as --text -. Put the words in a file and pass --text-file <path>.");
|
|
22745
|
+
}
|
|
22746
|
+
if (textFile === void 0 && process.stdin.isTTY) {
|
|
22747
|
+
throw usageError("--text - reads stdin, and nothing is piped in. Pipe the words in, or pass --text-file <path>.");
|
|
22748
|
+
}
|
|
22749
|
+
const source = textFile ?? "stdin";
|
|
22750
|
+
let words;
|
|
22751
|
+
try {
|
|
22752
|
+
words = readFileSync(textFile ?? 0, "utf8").replace(/\r?\n$/, "");
|
|
22753
|
+
} catch (error) {
|
|
22754
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22755
|
+
throw usageError(`Could not read ${source} (${reason}). Pass a file you can read.`);
|
|
22756
|
+
}
|
|
22757
|
+
if (words.trim() === "") throw usageError(`${source} holds no text. Pass the directory's words.`);
|
|
22758
|
+
return words;
|
|
22759
|
+
}
|
|
22760
|
+
function recordVerb(submission, name, description) {
|
|
22761
|
+
return withJson(verb(submission, name, description)).option("--observed", "You saw it yourself. Without it, it is recorded as reported: someone told you.").option("--idempotency-key <key>", "Replay guard: a retry returns the event already recorded");
|
|
22762
|
+
}
|
|
22763
|
+
function bindRecord(command, operation, fields) {
|
|
22764
|
+
bindOperation(
|
|
22765
|
+
command,
|
|
22766
|
+
{
|
|
22767
|
+
execute: async (input, context) => {
|
|
22768
|
+
const result = await operation.execute(input, context);
|
|
22769
|
+
if (result.event.replayed) {
|
|
22770
|
+
note(command, [`This idempotency key already recorded event ${result.event.id}. Nothing new was recorded.`]);
|
|
22771
|
+
}
|
|
22772
|
+
return result;
|
|
22773
|
+
}
|
|
22774
|
+
},
|
|
22775
|
+
(options, id) => checked(operation, {
|
|
22776
|
+
...scoped(options, id),
|
|
22777
|
+
...fields(options),
|
|
22778
|
+
reportedOrObserved: options.observed ? "observed" : void 0,
|
|
22779
|
+
idempotencyKey: options.idempotencyKey
|
|
22780
|
+
})
|
|
22781
|
+
);
|
|
22782
|
+
}
|
|
22783
|
+
function registerSubmissionHandoffCommands(submission) {
|
|
22784
|
+
const handoff = addPlatformOptions(
|
|
22785
|
+
withJson(verb(submission, "handoff", "Where the submission stands and what to do next, from its id alone"))
|
|
22786
|
+
);
|
|
22787
|
+
handoff.action(async (id, _options, command) => {
|
|
22788
|
+
const read = getDirectorySubmissionHandoffOperation;
|
|
22789
|
+
const input = checked(read, scoped(platformOptionsOf(command), id));
|
|
22790
|
+
const result = await runFor(command, (context) => read.execute(input, context));
|
|
22791
|
+
writeResult(result, getGlobalOptions(command).format);
|
|
22792
|
+
note(command, nextSteps(result.nextActions));
|
|
22793
|
+
});
|
|
22794
|
+
const findings = addPlatformOptions(
|
|
22795
|
+
withJson(verb(submission, "findings", "List the submission's stored findings, newest first, a page at a time")).option("--status <status>", "Only findings with this status, such as violated").option("--step <id>", "Only findings shown at this portal step").option("--lane <lane>", "Only findings from this lane, such as directory-policy").option("--all", "Read every page, not only the first")
|
|
22796
|
+
);
|
|
22797
|
+
findings.action(async (id, _options, command) => {
|
|
22798
|
+
const options = platformOptionsOf(command);
|
|
22799
|
+
const { status: status2, step, lane, all } = options;
|
|
22800
|
+
const list = listDirectorySubmissionFindingsOperation;
|
|
22801
|
+
const input = checked(list, { ...scoped(options, id), status: status2, step, lane, limit: all ? PAGE : void 0 });
|
|
22802
|
+
const result = await runFor(
|
|
22803
|
+
command,
|
|
22804
|
+
(context) => all ? everyFinding(input, context, command) : list.execute(input, context)
|
|
22805
|
+
);
|
|
22806
|
+
writeResult(result, getGlobalOptions(command).format);
|
|
22807
|
+
if (result.nextCursor) {
|
|
22808
|
+
note(command, [`Showing the first ${result.findings.length} findings. Pass --all to read every page.`]);
|
|
22809
|
+
}
|
|
22810
|
+
});
|
|
22811
|
+
const finding2 = withJson(
|
|
22812
|
+
verb(submission, "finding", "Read one check's stored result, with the observation behind it")
|
|
22813
|
+
).argument("<checkId>", "The check's id, such as claude.endpoint.https");
|
|
22814
|
+
bindOperation(
|
|
22815
|
+
finding2,
|
|
22816
|
+
getDirectorySubmissionFindingOperation,
|
|
22817
|
+
(options, id, check) => checked(getDirectorySubmissionFindingOperation, { ...scoped(options, id), check })
|
|
22818
|
+
);
|
|
22819
|
+
const pack = addPlatformOptions(
|
|
22820
|
+
verb(submission, "export", "Export the pack the team receives, byte for byte as the API serves it").option("--markdown", "The Markdown pack, for a person or a ticket, in place of JSON").option("--out <path>", "Save the pack to this file, or in this folder under its own name")
|
|
22821
|
+
);
|
|
22822
|
+
pack.action(async (id, _options, command) => {
|
|
22823
|
+
if (command.optsWithGlobals().format === "markdown") {
|
|
22824
|
+
throw usageError("For the Markdown pack, pass --markdown. --format chooses json or human output.");
|
|
22825
|
+
}
|
|
22826
|
+
const options = platformOptionsOf(command);
|
|
22827
|
+
const read = exportDirectorySubmissionOperation;
|
|
22828
|
+
const input = checked(read, { ...scoped(options, id), format: options.markdown ? "markdown" : void 0 });
|
|
22829
|
+
const { content, ...file2 } = await runFor(command, (context) => read.execute(input, context));
|
|
22830
|
+
if (options.out === void 0) {
|
|
22831
|
+
process.stdout.write(content);
|
|
22832
|
+
return;
|
|
22833
|
+
}
|
|
22834
|
+
const saved = await savePack(options.out, file2.filename, content);
|
|
22835
|
+
writeResult({ ...file2, path: saved, bytes: Buffer.byteLength(content) }, getGlobalOptions(command).format);
|
|
22836
|
+
});
|
|
22837
|
+
const events = withJson(
|
|
22838
|
+
verb(submission, "events", "List what was recorded about the submission outside MCPJam, newest first")
|
|
22839
|
+
).option("--kind <kind>", "Only events of this kind, such as status or directory-finding");
|
|
22840
|
+
bindOperation(
|
|
22841
|
+
events,
|
|
22842
|
+
listDirectorySubmissionEventsOperation,
|
|
22843
|
+
(options, id) => checked(listDirectorySubmissionEventsOperation, { ...scoped(options, id), kind: options.kind })
|
|
22844
|
+
);
|
|
22845
|
+
const status = recordVerb(submission, "status", "Record where the directory has the submission, as seen or as told").requiredOption("--state <state>", "The stage, such as submitted, in-review or approved").option("--directory-label <words>", "The directory's own words for the state, verbatim").option("--uncertain", "The portal's outcome was unclear, such as a submit dialog that stayed busy").option("--link <url>", "An https link to the submission in the directory").option("--reference <text>", "A confirmation reference the directory gave").option("--detail <text>", "Anything else the next person should know").option("--evidence <kind=value>", EVIDENCE);
|
|
22846
|
+
bindRecord(status, recordDirectorySubmissionStatusOperation, (options) => ({
|
|
22847
|
+
state: options.state,
|
|
22848
|
+
directoryLabel: options.directoryLabel,
|
|
22849
|
+
uncertain: options.uncertain,
|
|
22850
|
+
link: options.link,
|
|
22851
|
+
reference: options.reference,
|
|
22852
|
+
detail: options.detail,
|
|
22853
|
+
evidence: evidenceOf(options.evidence)
|
|
22854
|
+
}));
|
|
22855
|
+
const snapshot = recordVerb(submission, "snapshot", "Record which server revision one copy of the catalog holds").addOption(new Option("--label <label>", "Which copy").choices(DIRECTORY_SNAPSHOT_LABELS).makeOptionMandatory()).option(
|
|
22856
|
+
"--revision <n>",
|
|
22857
|
+
"The server revision it holds. Without one, what it holds stays unknown.",
|
|
22858
|
+
(value) => parsePositiveInteger(value, "--revision")
|
|
22859
|
+
).option("--server <id-or-name>", "The saved server the copy is of. Defaults to the submission's own.").option("--captured-at <time>", "When the copy was seen, such as 2026-11-13T09:30:00Z").option("--note <text>", "How you know, such as what the portal's tool list showed").option("--evidence <kind=value>", EVIDENCE);
|
|
22860
|
+
bindRecord(snapshot, recordDirectorySubmissionSnapshotOperation, (options) => ({
|
|
22861
|
+
label: options.label,
|
|
22862
|
+
revisionNumber: options.revision,
|
|
22863
|
+
server: options.server,
|
|
22864
|
+
capturedAt: epochOf("--captured-at", options.capturedAt),
|
|
22865
|
+
note: options.note,
|
|
22866
|
+
evidence: evidenceOf(options.evidence)
|
|
22867
|
+
}));
|
|
22868
|
+
const said = recordVerb(submission, "import-finding", "Keep what the directory said about the submission, verbatim").option("--text-file <path>", "Read the directory's words from this file").option("--text <source>", "Pass - to read the directory's words from stdin").requiredOption("--via <channel>", "How it arrived: email, portal or other").option("--severity <text>", "The directory's own severity, as given").option("--code <text>", "The directory's code for it, as given").option("--submission-version <text>", "The version of the submission it is about").option("--received-at <time>", "When it arrived, such as 2026-11-13T09:30:00Z").option("--link <url>", "An https link to the message, if it has one").hook("preAction", (self) => {
|
|
22869
|
+
self.setOptionValue("words", directoryWords(self.opts()));
|
|
22870
|
+
});
|
|
22871
|
+
bindRecord(said, importDirectoryFindingOperation, (options) => ({
|
|
22872
|
+
text: options.words,
|
|
22873
|
+
via: options.via,
|
|
22874
|
+
severity: options.severity,
|
|
22875
|
+
code: options.code,
|
|
22876
|
+
version: options.submissionVersion,
|
|
22877
|
+
receivedAt: epochOf("--received-at", options.receivedAt),
|
|
22878
|
+
link: options.link
|
|
22879
|
+
}));
|
|
22880
|
+
}
|
|
22881
|
+
var scoped2 = (options, submission = "") => ({ project: options.project, submission });
|
|
22882
|
+
function guarded(command) {
|
|
22883
|
+
return command.option(
|
|
22884
|
+
"--expected-revision <n>",
|
|
22885
|
+
"The revision you read. Without it, the current revision is read first.",
|
|
22886
|
+
(value) => parsePositiveInteger(value, "--expected-revision")
|
|
22887
|
+
).option("--idempotency-key <key>", "Replay guard: a retry is answered from the first write");
|
|
22888
|
+
}
|
|
22889
|
+
function linkInput(options, submission, change) {
|
|
22890
|
+
const { expectedRevision, idempotencyKey } = options;
|
|
22891
|
+
return { ...scoped2(options, submission), ...change, expectedRevision, idempotencyKey };
|
|
22892
|
+
}
|
|
22893
|
+
async function saveFile(out, filename, content) {
|
|
22894
|
+
const folder = statSync(out, { throwIfNoEntry: false })?.isDirectory();
|
|
22895
|
+
const target = folder ? path3.join(out, path3.basename(filename)) : out;
|
|
22896
|
+
try {
|
|
22897
|
+
return await writeFileAtomic(target, content, { createParents: true });
|
|
22898
|
+
} catch (error) {
|
|
22899
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22900
|
+
throw operationalError(`Could not save the test cases to ${target} (${reason}). Pass another --out path.`);
|
|
22901
|
+
}
|
|
22902
|
+
}
|
|
22903
|
+
function shortfall({ counts, required, omitted }) {
|
|
22904
|
+
const lines = omitted.map(
|
|
22905
|
+
({ title, reason }) => `Left out "${title}": it has no ${reason === "no_prompt" ? "prompt" : "expectation"}. Add one to the case, then export again.`
|
|
22906
|
+
);
|
|
22907
|
+
if (counts.successful !== required.successful || counts.gracefulFailure !== required.gracefulFailure) {
|
|
22908
|
+
lines.push(
|
|
22909
|
+
`The form asks for ${required.successful} successful and ${required.gracefulFailure} graceful-failure cases; this file has ${counts.successful} and ${counts.gracefulFailure}.`
|
|
22910
|
+
);
|
|
22911
|
+
}
|
|
22912
|
+
return lines;
|
|
22913
|
+
}
|
|
22914
|
+
function registerSubmissionEvalCommands(submission) {
|
|
22915
|
+
const evals = submission.command("evals").description("Link, import, read and export the eval suite that holds a submission's test cases");
|
|
22916
|
+
const verb2 = (name, description) => addProjectOption(evals.command(name).description(description).argument("<submission>", "Submission id"));
|
|
22917
|
+
const show = verb2("show", "Read the linked suite and run, and each case's result in that run");
|
|
22918
|
+
bindOperation(show, getDirectorySubmissionEvalsOperation, scoped2);
|
|
22919
|
+
const link = guarded(
|
|
22920
|
+
verb2("link", "Link the eval suite that holds the submission's test cases, or the run that last ran them").option("--suite <id>", "An eval suite in the submission's project").option("--run <id>", "A run of the linked suite, or of --suite")
|
|
22921
|
+
);
|
|
22922
|
+
bindOperation(link, setDirectorySubmissionEvalsOperation, (options, id = "") => {
|
|
22923
|
+
if (options.suite === void 0 && options.run === void 0) {
|
|
22924
|
+
throw usageError("Pass --suite, --run or both.");
|
|
22925
|
+
}
|
|
22926
|
+
return linkInput(options, id, { suite: options.suite, run: options.run });
|
|
22927
|
+
});
|
|
22928
|
+
const unlink3 = guarded(
|
|
22929
|
+
verb2("unlink", "Unlink the submission's eval suite and its run").option(
|
|
22930
|
+
"--run-only",
|
|
22931
|
+
"Keep the suite and clear only the run"
|
|
22932
|
+
)
|
|
22933
|
+
);
|
|
22934
|
+
bindOperation(
|
|
22935
|
+
unlink3,
|
|
22936
|
+
setDirectorySubmissionEvalsOperation,
|
|
22937
|
+
(options, id = "") => linkInput(options, id, options.runOnly ? { run: null } : { suite: null })
|
|
22938
|
+
);
|
|
22939
|
+
const add = verb2("import", "Import the test cases of the submission's ChatGPT plugin version into its linked suite").option("--plugin-version <id>", "The version you expect the submission to name; refused if it names another");
|
|
22940
|
+
bindOperation(add, importDirectorySubmissionTestCasesOperation, (options, id) => ({
|
|
22941
|
+
...scoped2(options, id),
|
|
22942
|
+
pluginVersionId: options.pluginVersion
|
|
22943
|
+
}));
|
|
22944
|
+
const pack = addPlatformOptions(
|
|
22945
|
+
verb2("export", "Export the linked suite's cases in the shape ChatGPT's form takes, byte for byte").option(
|
|
22946
|
+
"--out <path>",
|
|
22947
|
+
"Save the file to this path, or in this folder under its own name"
|
|
22948
|
+
)
|
|
22949
|
+
);
|
|
22950
|
+
pack.action(async (id, _options, command) => {
|
|
22951
|
+
const options = platformOptionsOf(command);
|
|
22952
|
+
const { timeout, quiet, format } = getGlobalOptions(command);
|
|
22953
|
+
const extras = { announce: false, quiet, command: "readiness submission evals export" };
|
|
22954
|
+
const read = exportDirectorySubmissionTestCasesOperation;
|
|
22955
|
+
const result = await runPlatformOperation(options, timeout, (context) => read.execute(scoped2(options, id), context), extras);
|
|
22956
|
+
const { content, ...file2 } = result;
|
|
22957
|
+
if (options.out === void 0) {
|
|
22958
|
+
process.stdout.write(content);
|
|
22959
|
+
} else {
|
|
22960
|
+
const saved = await saveFile(options.out, file2.filename, content);
|
|
22961
|
+
writeResult({ ...file2, path: saved, bytes: Buffer.byteLength(content) }, format);
|
|
22962
|
+
}
|
|
22963
|
+
const notes = shortfall(result);
|
|
22964
|
+
if (notes.length > 0 && !quiet) process.stderr.write(`${notes.join("\n")}
|
|
22965
|
+
`);
|
|
22966
|
+
});
|
|
22967
|
+
}
|
|
22968
|
+
var scoped3 = (options, submission = "") => ({ project: options.project, submission });
|
|
22969
|
+
function readJson(file2) {
|
|
22970
|
+
let text;
|
|
22971
|
+
try {
|
|
22972
|
+
text = file2 === "-" ? readFileSync(0, "utf8") : readFileSync(file2, "utf8");
|
|
22973
|
+
} catch (error) {
|
|
22974
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
22975
|
+
throw usageError(`Could not read ${file2} (${reason}). Pass the path of a plan file, or - for stdin.`);
|
|
22976
|
+
}
|
|
22977
|
+
try {
|
|
22978
|
+
return JSON.parse(text);
|
|
22979
|
+
} catch {
|
|
22980
|
+
throw usageError(`${file2} is not JSON. Pass a plan, as \`plan draft --output\` writes one.`);
|
|
22981
|
+
}
|
|
22982
|
+
}
|
|
22983
|
+
function readPlanFile(options, submission) {
|
|
22984
|
+
const file2 = options.file ?? "";
|
|
22985
|
+
const value = readJson(file2);
|
|
22986
|
+
const printed = value && typeof value === "object" && "plan" in value ? value : {};
|
|
22987
|
+
const parsed = directoryTestPlanSchema.safeParse("plan" in printed ? printed.plan : value);
|
|
22988
|
+
if (!parsed.success) {
|
|
22989
|
+
const issue = parsed.error.issues[0];
|
|
22990
|
+
const where = issue?.path.length ? `${issue.path.join(".")}: ` : "";
|
|
22991
|
+
throw usageError(`${file2} is not a test plan. ${where}${issue?.message ?? "Unreadable."}`);
|
|
22992
|
+
}
|
|
22993
|
+
const read = [printed.revision, printed.currentRevision].find(
|
|
22994
|
+
(revision) => typeof revision === "number"
|
|
22995
|
+
);
|
|
22996
|
+
const expectedRevision = options.expectedRevision ?? read;
|
|
22997
|
+
if (expectedRevision === void 0) {
|
|
22998
|
+
throw usageError("Pass --expected-revision: the revision you read, or 0 for the submission's first plan.");
|
|
22999
|
+
}
|
|
23000
|
+
return { ...scoped3(options, submission), expectedRevision, plan: parsed.data };
|
|
23001
|
+
}
|
|
23002
|
+
function registerTestPlanCommands(submission) {
|
|
23003
|
+
const plan = submission.command("plan").description("Draft, read and save the test plan whose tool calls a submission's runs make");
|
|
23004
|
+
const verb2 = (name, description) => addProjectOption(plan.command(name).description(description).argument("<submission>", "Submission id"));
|
|
23005
|
+
const show = verb2("show", "Read the saved test plan, and what keeps it from running").option(
|
|
23006
|
+
"--revision <n>",
|
|
23007
|
+
"A kept revision to read. Defaults to the current plan.",
|
|
23008
|
+
(value) => parsePositiveInteger(value, "--revision")
|
|
23009
|
+
);
|
|
23010
|
+
bindOperation(show, getDirectorySubmissionTestPlanOperation, (options, id) => ({
|
|
23011
|
+
...scoped3(options, id),
|
|
23012
|
+
revision: options.revision
|
|
23013
|
+
}));
|
|
23014
|
+
const draft = verb2("draft", "Draft a plan that calls every tool the server lists. Saves nothing.").option(
|
|
23015
|
+
"--output <file>",
|
|
23016
|
+
"Write the drafted plan to this file, to edit and then save with `plan save`"
|
|
23017
|
+
);
|
|
23018
|
+
bindOperation(
|
|
23019
|
+
draft,
|
|
23020
|
+
{
|
|
23021
|
+
execute: async ({ output, ...input }, context) => {
|
|
23022
|
+
const drafted = await draftDirectorySubmissionTestPlanOperation.execute(input, context);
|
|
23023
|
+
if (output === void 0) return drafted;
|
|
23024
|
+
writeFileSync(output, `${JSON.stringify(drafted.plan, null, 2)}
|
|
23025
|
+
`);
|
|
23026
|
+
const { plan: _plan, ...rest } = drafted;
|
|
23027
|
+
return { ...rest, planFile: output };
|
|
23028
|
+
}
|
|
23029
|
+
},
|
|
23030
|
+
(options, id) => ({ ...scoped3(options, id), output: options.output })
|
|
23031
|
+
);
|
|
23032
|
+
const save = verb2("save", "Save a plan file as the submission's next revision").requiredOption("--file <path>", "The plan: a file `plan draft --output` wrote, what `plan show` printed, or - for stdin").option(
|
|
23033
|
+
"--expected-revision <n>",
|
|
23034
|
+
"The revision you read; 0 for the first plan. Defaults to the one in the file, when it names one.",
|
|
23035
|
+
(value) => parseNonNegativeInteger(value, "--expected-revision")
|
|
23036
|
+
);
|
|
23037
|
+
bindOperation(save, saveDirectorySubmissionTestPlanOperation, (options, id = "") => readPlanFile(options, id));
|
|
23038
|
+
const results = verb2("results", "Read what a run's test plan calls showed, tool by tool").option("--run <id>", "A run's id. Defaults to the newest run that named a test plan.").option("--tool <name>", "One tool, with the call behind each of its cases").addOption(new Option("--status <status>", "List the tools with this status").choices(DIRECTORY_TOOL_TEST_STATUSES));
|
|
23039
|
+
bindOperation(results, getDirectorySubmissionToolTestsOperation, (options, id) => ({
|
|
23040
|
+
...scoped3(options, id),
|
|
23041
|
+
run: options.run,
|
|
23042
|
+
tool: options.tool,
|
|
23043
|
+
status: options.status
|
|
23044
|
+
}));
|
|
23045
|
+
}
|
|
23046
|
+
|
|
23047
|
+
// src/commands/readiness-submissions.ts
|
|
23048
|
+
var RUN_WAIT_MS = 20 * 6e4;
|
|
23049
|
+
var RUN_POLL_MS = 5e3;
|
|
23050
|
+
var RUN_ENDED = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
23051
|
+
var PROJECT_SCOPED = { ambientProject: true };
|
|
23052
|
+
var scoped4 = (options, submission = "") => ({ project: options.project, submission });
|
|
23053
|
+
var extrasOf = (command, name) => ({
|
|
23054
|
+
announce: false,
|
|
23055
|
+
quiet: getGlobalOptions(command).quiet,
|
|
23056
|
+
command: `readiness submission ${name}`
|
|
23057
|
+
});
|
|
23058
|
+
function jsonOrText(text) {
|
|
23059
|
+
try {
|
|
23060
|
+
return JSON.parse(text);
|
|
23061
|
+
} catch {
|
|
23062
|
+
return text;
|
|
23063
|
+
}
|
|
23064
|
+
}
|
|
23065
|
+
function subjectOf(options) {
|
|
23066
|
+
const { plugin: pluginId, pluginVersion: pluginVersionId, attempt } = options;
|
|
23067
|
+
const named = pluginId !== void 0 || pluginVersionId !== void 0;
|
|
23068
|
+
if (options.clearPlugin && named) {
|
|
23069
|
+
throw usageError(
|
|
23070
|
+
"Pass --clear-plugin, or --plugin and --plugin-version, not both."
|
|
23071
|
+
);
|
|
23072
|
+
}
|
|
23073
|
+
if (options.clearAttempt && attempt !== void 0) {
|
|
23074
|
+
throw usageError("Pass --attempt or --clear-attempt, not both.");
|
|
23075
|
+
}
|
|
23076
|
+
const plugin = named ? { pluginId, pluginVersionId } : void 0;
|
|
23077
|
+
return {
|
|
23078
|
+
plugin: options.clearPlugin ? null : plugin,
|
|
23079
|
+
attempt: options.clearAttempt ? null : attempt
|
|
23080
|
+
};
|
|
23081
|
+
}
|
|
23082
|
+
function parseSetInput(options, submission) {
|
|
23083
|
+
const answers = /* @__PURE__ */ new Map();
|
|
23084
|
+
const add = (key, value) => {
|
|
23085
|
+
if (answers.has(key)) throw usageError(`${key} is given twice. Pass one --answer or --unset per field.`);
|
|
23086
|
+
answers.set(key, value);
|
|
23087
|
+
};
|
|
23088
|
+
for (const pair of options.answer) {
|
|
23089
|
+
const split = pair.indexOf("=");
|
|
23090
|
+
if (split <= 0) throw usageError(`--answer takes key=value, not "${pair}".`);
|
|
23091
|
+
add(pair.slice(0, split).trim(), jsonOrText(pair.slice(split + 1)));
|
|
23092
|
+
}
|
|
23093
|
+
for (const key of options.unset) add(key.trim(), null);
|
|
23094
|
+
const subject = subjectOf(options);
|
|
23095
|
+
const unchanged = [options.title, subject.plugin, subject.attempt].every(
|
|
23096
|
+
(value) => value === void 0
|
|
23097
|
+
);
|
|
23098
|
+
if (answers.size === 0 && options.confirm.length === 0 && unchanged) {
|
|
23099
|
+
throw usageError(
|
|
23100
|
+
"Nothing to save. Pass --answer, --unset, --confirm, --title, --plugin-version or --attempt."
|
|
23101
|
+
);
|
|
23102
|
+
}
|
|
23103
|
+
const parsed = updateDirectorySubmissionOperation.inputSchema.safeParse({
|
|
23104
|
+
...scoped4(options, submission),
|
|
23105
|
+
...answers.size > 0 ? { answers: Object.fromEntries(answers) } : {},
|
|
23106
|
+
...options.confirm.length > 0 ? { confirm: options.confirm } : {},
|
|
23107
|
+
title: options.title,
|
|
23108
|
+
...subject,
|
|
23109
|
+
expectedRevision: options.expectedRevision,
|
|
23110
|
+
idempotencyKey: options.idempotencyKey
|
|
23111
|
+
});
|
|
23112
|
+
if (parsed.success) return parsed.data;
|
|
23113
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
23114
|
+
}
|
|
23115
|
+
var RESUME_TRIES = 3;
|
|
23116
|
+
function isDefiniteRefusal(error) {
|
|
23117
|
+
return isPlatformApiError(error) && error.status >= 400 && error.status < 500 && ![408, 425, 429].includes(error.status);
|
|
23118
|
+
}
|
|
23119
|
+
async function resumeRun(options, timeoutMs, run, extras) {
|
|
23120
|
+
const resume = async (context) => {
|
|
23121
|
+
try {
|
|
23122
|
+
await context.client.resumeReadinessRun(run, { signal: context.signal });
|
|
23123
|
+
return void 0;
|
|
23124
|
+
} catch (error) {
|
|
23125
|
+
if (!isDefiniteRefusal(error)) throw error;
|
|
23126
|
+
return error instanceof Error ? error.message : String(error);
|
|
23127
|
+
}
|
|
23128
|
+
};
|
|
23129
|
+
let outcome = "settled";
|
|
23130
|
+
let note2 = `Run ${run.runId} stopped on the server and was resumed.`;
|
|
23131
|
+
try {
|
|
23132
|
+
const refusal = await runPlatformOperation(options, timeoutMs, resume, extras);
|
|
23133
|
+
if (refusal) note2 = `Run ${run.runId} stopped on the server and could not be resumed: ${refusal}`;
|
|
23134
|
+
} catch (error) {
|
|
23135
|
+
outcome = "transient";
|
|
23136
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
23137
|
+
note2 = `Run ${run.runId} stopped on the server and could not be resumed yet, so the resume will be tried again: ${reason}`;
|
|
23138
|
+
}
|
|
23139
|
+
if (!extras.quiet) process.stderr.write(`${note2}
|
|
23140
|
+
`);
|
|
23141
|
+
return outcome;
|
|
23142
|
+
}
|
|
23143
|
+
async function waitForRun(options, timeoutMs, run, extras) {
|
|
23144
|
+
const giveUpAt = Date.now() + RUN_WAIT_MS;
|
|
23145
|
+
const settled = /* @__PURE__ */ new Set();
|
|
23146
|
+
const transientTries = /* @__PURE__ */ new Map();
|
|
23147
|
+
for (; ; ) {
|
|
23148
|
+
const read = (context) => context.client.getReadinessRun(run, { signal: context.signal });
|
|
23149
|
+
const current = await runPlatformOperation(options, timeoutMs, read, extras);
|
|
23150
|
+
if (RUN_ENDED.has(current.status)) return current;
|
|
23151
|
+
const attempt = current.attemptCount;
|
|
23152
|
+
const tries = transientTries.get(attempt) ?? 0;
|
|
23153
|
+
if (current.resumable && !settled.has(attempt) && tries < RESUME_TRIES) {
|
|
23154
|
+
if (await resumeRun(options, timeoutMs, run, extras) === "settled") {
|
|
23155
|
+
settled.add(attempt);
|
|
23156
|
+
continue;
|
|
23157
|
+
}
|
|
23158
|
+
transientTries.set(attempt, tries + 1);
|
|
23159
|
+
}
|
|
23160
|
+
if (Date.now() + RUN_POLL_MS > giveUpAt) {
|
|
23161
|
+
const later = `mcpjam readiness status --run ${run.runId} --project ${run.projectId}`;
|
|
23162
|
+
throw new CliError(
|
|
23163
|
+
"RUN_NOT_FINISHED",
|
|
23164
|
+
`Run ${run.runId} is still ${current.status} after 20 minutes. Read it later with \`${later}\`.`,
|
|
23165
|
+
3
|
|
23166
|
+
);
|
|
23167
|
+
}
|
|
23168
|
+
await new Promise((resolve2) => setTimeout(resolve2, RUN_POLL_MS));
|
|
23169
|
+
}
|
|
23170
|
+
}
|
|
23171
|
+
async function runSubmission(submission, command) {
|
|
23172
|
+
const options = platformOptionsOf(command);
|
|
23173
|
+
const globals = getGlobalOptions(command);
|
|
23174
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
23175
|
+
const extras = { ...extrasOf(command, "run"), projectScope };
|
|
23176
|
+
const input = {
|
|
23177
|
+
...scoped4({ ...options, project }, submission),
|
|
23178
|
+
includeLlmObservations: options.aiObservations ? true : void 0,
|
|
23179
|
+
idempotencyKey: options.idempotencyKey,
|
|
23180
|
+
pluginVersionId: options.pluginVersion,
|
|
23181
|
+
testPlanRevision: options.testPlanRevision
|
|
23182
|
+
};
|
|
23183
|
+
const start = startDirectorySubmissionRunOperation;
|
|
23184
|
+
const started = await runPlatformOperation(options, globals.timeout, (context) => start.execute(input, context), extras);
|
|
23185
|
+
if (!options.wait) return writeResult(started, globals.format);
|
|
23186
|
+
const ids = { projectId: started.project.id, runId: started.run.runId };
|
|
23187
|
+
const run = await waitForRun(options, globals.timeout, ids, extras);
|
|
23188
|
+
if (run.status !== "completed") {
|
|
23189
|
+
writeResult({ ...started, run }, globals.format);
|
|
23190
|
+
reportReadinessVerdict({ summary: `the run ${run.status}` }, command);
|
|
23191
|
+
return setProcessExitCode(directoryReadinessExitCode({}));
|
|
23192
|
+
}
|
|
23193
|
+
const scope = { project: ids.projectId, submission, run: ids.runId };
|
|
23194
|
+
const read = getDirectorySubmissionResultsOperation;
|
|
23195
|
+
let results;
|
|
23196
|
+
try {
|
|
23197
|
+
results = await runPlatformOperation(options, globals.timeout, (context) => read.execute(scope, context), extras);
|
|
23198
|
+
} catch (error) {
|
|
23199
|
+
if (!(error instanceof CliError)) throw error;
|
|
23200
|
+
const later = `mcpjam readiness submission results ${submission} --run ${ids.runId}`;
|
|
23201
|
+
const message = `${error.message} The run finished. Read its results with \`${later}\`.`;
|
|
23202
|
+
throw new CliError(error.code, message, error.exitCode, error.details);
|
|
23203
|
+
}
|
|
23204
|
+
writeResult({ ...started, run, verdict: results.verdict }, globals.format);
|
|
23205
|
+
judgeResults(results, command);
|
|
23206
|
+
}
|
|
23207
|
+
function registerDirectorySubmissionCommands(readiness) {
|
|
23208
|
+
const flows = readiness.command("flows").description("List the directory forms MCPJam can rehearse, or show one").argument("[flow]", "Flow id, such as claude-connector").option("--step <id>", "Show only this step of the flow");
|
|
23209
|
+
bindOperation(
|
|
23210
|
+
flows,
|
|
23211
|
+
{
|
|
23212
|
+
execute: ({ flow, step }, context) => flow ? getDirectoryFlowOperation.execute({ flow, step }, context) : listDirectoryFlowsOperation.execute({}, context)
|
|
23213
|
+
},
|
|
23214
|
+
(options, flow) => {
|
|
23215
|
+
if (options.step && !flow) {
|
|
23216
|
+
throw usageError("--step needs a flow, as in `mcpjam readiness flows claude-connector --step listing`.");
|
|
23217
|
+
}
|
|
23218
|
+
return { flow, step: options.step };
|
|
23219
|
+
}
|
|
23220
|
+
);
|
|
23221
|
+
const submission = readiness.command("submission").description("Rehearse a directory submission for a saved server");
|
|
23222
|
+
const verb2 = (name, description, argument = true) => {
|
|
23223
|
+
const command = submission.command(name).description(description);
|
|
23224
|
+
return addProjectOption(argument ? command.argument("<submission>", "Submission id") : command);
|
|
23225
|
+
};
|
|
23226
|
+
const create = verb2("create", "Start a rehearsal of a directory's form for a saved server", false).requiredOption("--flow <id>", "Flow id, from `mcpjam readiness flows`").requiredOption("--server <id-or-name>", "Saved server the submission is for").option("--title <title>", "A name for the rehearsal").option("--idempotency-key <key>", "Replay guard: a retry returns the same submission");
|
|
23227
|
+
bindOperation(
|
|
23228
|
+
create,
|
|
23229
|
+
createDirectorySubmissionOperation,
|
|
23230
|
+
({ project, server = "", flow = "", title, idempotencyKey }) => ({
|
|
23231
|
+
project,
|
|
23232
|
+
server,
|
|
23233
|
+
flow,
|
|
23234
|
+
title,
|
|
23235
|
+
idempotencyKey
|
|
23236
|
+
}),
|
|
23237
|
+
PROJECT_SCOPED
|
|
23238
|
+
);
|
|
23239
|
+
const list = verb2("list", "List a project's submissions, newest first", false).option("--server <id-or-name>", "Narrow to one saved server").option("--flow <id>", "Narrow to one flow").option("--limit <n>", "Rows to return (1-100)", (value) => parsePositiveInteger(value, "Limit"));
|
|
23240
|
+
bindOperation(
|
|
23241
|
+
list,
|
|
23242
|
+
listDirectorySubmissionsOperation,
|
|
23243
|
+
({ project, server, flow, limit }) => ({ project, server, flow, limit }),
|
|
23244
|
+
PROJECT_SCOPED
|
|
23245
|
+
);
|
|
23246
|
+
const get = verb2("get", "Read a submission: its answers, who set them, and the portal's checks");
|
|
23247
|
+
bindOperation(get, getDirectorySubmissionOperation, scoped4, PROJECT_SCOPED);
|
|
23248
|
+
const set = verb2("set", "Save answers to a submission").option(
|
|
23249
|
+
"--answer <key=value>",
|
|
23250
|
+
'Set a field. The value is read as JSON when it parses (true, 3, ["a"]), otherwise as text. Repeatable.',
|
|
23251
|
+
collectRepeated,
|
|
23252
|
+
[]
|
|
23253
|
+
).option("--unset <key>", "Remove a field's answer. Repeatable.", collectRepeated, []).option("--confirm <key>", "Confirm a declaration as the portal words it now. Repeatable.", collectRepeated, []).option("--title <title>", "Rename the submission").option("--plugin <id>", "A ChatGPT plugin submission's stored plugin").option("--plugin-version <id>", "The plugin version to submit. It names its plugin, so --plugin can be left out").option("--clear-plugin", "Remove the submission's plugin and version").option(
|
|
23254
|
+
"--attempt <n>",
|
|
23255
|
+
"Which submission this is: 1, then one more per resubmission",
|
|
23256
|
+
(value) => parsePositiveInteger(value, "--attempt")
|
|
23257
|
+
).option("--clear-attempt", "Remove the submission's attempt number").option(
|
|
23258
|
+
"--expected-revision <n>",
|
|
23259
|
+
"The revision you read. Without it, the current revision is read first.",
|
|
23260
|
+
(value) => parsePositiveInteger(value, "--expected-revision")
|
|
23261
|
+
).option(
|
|
23262
|
+
"--retry-on-conflict",
|
|
23263
|
+
"If someone changed a field you set since your revision, write once more over their change"
|
|
23264
|
+
).option("--idempotency-key <key>", "Replay guard: a retry is answered from the first write");
|
|
23265
|
+
bindOperation(
|
|
23266
|
+
set,
|
|
23267
|
+
{
|
|
23268
|
+
// `--retry-on-conflict`: one more write, over the revision the refusal names.
|
|
23269
|
+
execute: async ({ retry, ...input }, context) => {
|
|
23270
|
+
try {
|
|
23271
|
+
return await updateDirectorySubmissionOperation.execute(input, context);
|
|
23272
|
+
} catch (error) {
|
|
23273
|
+
const conflict = retry ? directorySubmissionConflict(error) : void 0;
|
|
23274
|
+
if (!conflict) throw error;
|
|
23275
|
+
const again = { ...input, expectedRevision: conflict.currentRevision };
|
|
23276
|
+
return updateDirectorySubmissionOperation.execute(again, context);
|
|
23277
|
+
}
|
|
23278
|
+
}
|
|
23279
|
+
},
|
|
23280
|
+
(options, id = "") => ({ ...parseSetInput(options, id), retry: options.retryOnConflict === true }),
|
|
23281
|
+
PROJECT_SCOPED
|
|
23282
|
+
);
|
|
23283
|
+
const remove = verb2("delete", "Delete a submission and its answers. This cannot be undone.");
|
|
23284
|
+
bindOperation(remove, deleteDirectorySubmissionOperation, scoped4, PROJECT_SCOPED);
|
|
23285
|
+
const run = addPlatformOptions(
|
|
23286
|
+
verb2("run", "Grade a submission's server and answers on the platform").option("--wait", "Wait for the run to end, then exit 0 ready, 1 not ready or 3 incomplete").option("--ai-observations", "Add optional model observations, included with MCPJam").option("--plugin-version <id>", "The stored plugin version to grade. Required for a ChatGPT plugin submission").option(
|
|
23287
|
+
"--test-plan-revision <n>",
|
|
23288
|
+
"Also make the calls of the saved test plan at this revision, from `plan show`. It must be the current one.",
|
|
23289
|
+
(value) => parsePositiveInteger(value, "--test-plan-revision")
|
|
23290
|
+
).option("--idempotency-key <key>", "Replay guard: a retry returns the run already started")
|
|
23291
|
+
);
|
|
23292
|
+
run.action(
|
|
23293
|
+
(id, _options, command) => (
|
|
23294
|
+
// Under --wait the exit code is the verdict.
|
|
23295
|
+
platformOptionsOf(command).wait ? withVerdictExit(() => runSubmission(id, command)) : runSubmission(id, command)
|
|
23296
|
+
)
|
|
23297
|
+
);
|
|
23298
|
+
const results = addPlatformOptions(
|
|
23299
|
+
verb2("results", "Read a submission's results by the portal's steps, and exit with its verdict").option("--run <id>", "A completed run's id. Defaults to the latest.").option("--json", "Print JSON (same as --format json)").hook("preAction", (command) => {
|
|
23300
|
+
if (command.opts().json) command.setOptionValue("format", "json");
|
|
23301
|
+
})
|
|
23302
|
+
);
|
|
23303
|
+
results.action(
|
|
23304
|
+
(id, _options, command) => withVerdictExit(async () => {
|
|
23305
|
+
const options = platformOptionsOf(command);
|
|
23306
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
23307
|
+
const input = { ...scoped4({ ...options, project }, id), run: options.run };
|
|
23308
|
+
const read = getDirectorySubmissionResultsOperation;
|
|
23309
|
+
const { timeout, format } = getGlobalOptions(command);
|
|
23310
|
+
const execute = (context) => read.execute(input, context);
|
|
23311
|
+
const result = await runPlatformOperation(options, timeout, execute, {
|
|
23312
|
+
...extrasOf(command, "results"),
|
|
23313
|
+
projectScope
|
|
23314
|
+
});
|
|
23315
|
+
writeResult(result, format);
|
|
23316
|
+
judgeResults(result, command);
|
|
23317
|
+
})
|
|
23318
|
+
);
|
|
23319
|
+
const gate = addPlatformOptions(
|
|
23320
|
+
verb2("gate", "Choose which checks fail the submission's runs. Check ids are in its results.").option(
|
|
23321
|
+
"--fail-on <id>",
|
|
23322
|
+
"Fail a run when this check fails, even one the directory does not require. Repeatable.",
|
|
23323
|
+
collectRepeated,
|
|
23324
|
+
[]
|
|
23325
|
+
).option("--warn-only <id>", "Show this check's result without failing the run. Repeatable.", collectRepeated, []).option("--clear", "Start from the directory's blocking checks, dropping earlier choices")
|
|
23326
|
+
);
|
|
23327
|
+
gate.action(async (id, _options, command) => {
|
|
23328
|
+
const options = platformOptionsOf(command);
|
|
23329
|
+
const { project, projectScope } = resolveCloudProjectArgs(options);
|
|
23330
|
+
const change = parseGateChange(options, id);
|
|
23331
|
+
const { timeout, format } = getGlobalOptions(command);
|
|
23332
|
+
const save = (context) => saveGate(scoped4({ ...options, project }, id), change, context);
|
|
23333
|
+
const saved = await runPlatformOperation(options, timeout, save, {
|
|
23334
|
+
...extrasOf(command, "gate"),
|
|
23335
|
+
projectScope
|
|
23336
|
+
});
|
|
23337
|
+
writeResult(saved, format);
|
|
23338
|
+
reportGate(saved.submission.checkGate, command);
|
|
23339
|
+
});
|
|
23340
|
+
registerSubmissionHandoffCommands(submission);
|
|
23341
|
+
registerTestPlanCommands(submission);
|
|
23342
|
+
registerSubmissionEvalCommands(submission);
|
|
23343
|
+
}
|
|
23344
|
+
var scoped5 = (options, submission = "") => ({ project: options.project, submission });
|
|
23345
|
+
function registerReviewerAttemptCommands(readiness) {
|
|
23346
|
+
const reviewer = readiness.command("reviewer").description("Rehearse a directory reviewer's sign-in to a submission's server");
|
|
23347
|
+
const verb2 = (name, description) => addProjectOption(reviewer.command(name).description(description).argument("<submission>", "Submission id"));
|
|
23348
|
+
const start = verb2("start", "Sign in as the reviewer with credentials saved as project secrets").requiredOption("--password-secret <name>", "Name of the project secret holding the reviewer's password").option("--username-secret <name>", "Name of the project secret holding the reviewer's username").option("--username <text>", "The reviewer's username, when it is not a secret").option("--login-url <url>", "The https sign-in page the reviewer starts on").option("--tenant <name>", "The organization the reviewer must end up signed in to").option("--idempotency-key <key>", "Replay guard: a retry returns the same attempt and run");
|
|
23349
|
+
bindOperation(start, createReviewerAttemptOperation, (options, submission) => {
|
|
23350
|
+
const parsed = createReviewerAttemptOperation.inputSchema.safeParse({
|
|
23351
|
+
...scoped5(options, submission),
|
|
23352
|
+
passwordSecretName: options.passwordSecret,
|
|
23353
|
+
usernameSecretName: options.usernameSecret,
|
|
23354
|
+
username: options.username,
|
|
23355
|
+
loginUrl: options.loginUrl,
|
|
23356
|
+
tenant: options.tenant,
|
|
23357
|
+
idempotencyKey: options.idempotencyKey
|
|
23358
|
+
});
|
|
23359
|
+
if (parsed.success) return parsed.data;
|
|
23360
|
+
throw usageError(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
23361
|
+
});
|
|
23362
|
+
const status = verb2("status", "List a submission's sign-in attempts, newest first, or show one").option("--attempt <id>", "Show only this attempt, with its stages").option("--limit <n>", "Attempts to list (1-50)", (value) => parsePositiveInteger(value, "Limit"));
|
|
23363
|
+
bindOperation(
|
|
23364
|
+
status,
|
|
23365
|
+
{
|
|
23366
|
+
execute: ({ attempt, limit, ...scope }, context) => attempt ? getReviewerAttemptOperation.execute({ ...scope, attempt }, context) : listReviewerAttemptsOperation.execute({ ...scope, limit }, context)
|
|
23367
|
+
},
|
|
23368
|
+
(options, submission) => ({ ...scoped5(options, submission), attempt: options.attempt, limit: options.limit })
|
|
23369
|
+
);
|
|
23370
|
+
const resume = verb2("resume", "Continue an attempt waiting for a person, in a new run").requiredOption(
|
|
23371
|
+
"--attempt <id>",
|
|
23372
|
+
"The attempt's id"
|
|
23373
|
+
);
|
|
23374
|
+
bindOperation(resume, resumeReviewerAttemptOperation, (options, submission) => ({
|
|
23375
|
+
...scoped5(options, submission),
|
|
23376
|
+
attempt: options.attempt ?? ""
|
|
23377
|
+
}));
|
|
23378
|
+
const handoff = verb2("handoff", "Create a single-use link to finish a paused reviewer sign-in").requiredOption("--attempt <id>", "The attempt's id");
|
|
23379
|
+
bindOperation(handoff, createReviewerHandoffOperation, (options, submission) => ({
|
|
23380
|
+
...scoped5(options, submission),
|
|
23381
|
+
attempt: options.attempt ?? ""
|
|
23382
|
+
}));
|
|
23383
|
+
const cancel = verb2("cancel", "Stop an attempt that is running or waiting for a person").requiredOption(
|
|
23384
|
+
"--attempt <id>",
|
|
23385
|
+
"The attempt's id"
|
|
23386
|
+
);
|
|
23387
|
+
bindOperation(cancel, cancelReviewerAttemptOperation, (options, submission) => ({
|
|
23388
|
+
...scoped5(options, submission),
|
|
23389
|
+
attempt: options.attempt ?? ""
|
|
23390
|
+
}));
|
|
23391
|
+
}
|
|
21958
23392
|
|
|
21959
23393
|
// src/commands/readiness.ts
|
|
21960
23394
|
function getFormat2(command, reporter) {
|
|
@@ -21982,17 +23416,17 @@ function mcpRequestHeaders(options, target) {
|
|
|
21982
23416
|
if (token) headers.authorization = `Bearer ${token}`;
|
|
21983
23417
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
21984
23418
|
}
|
|
21985
|
-
async function openPackage(
|
|
23419
|
+
async function openPackage(path14) {
|
|
21986
23420
|
let info;
|
|
21987
23421
|
try {
|
|
21988
|
-
info = await stat(
|
|
23422
|
+
info = await stat(path14);
|
|
21989
23423
|
} catch {
|
|
21990
|
-
throw usageError(`Package path "${
|
|
23424
|
+
throw usageError(`Package path "${path14}" does not exist.`);
|
|
21991
23425
|
}
|
|
21992
23426
|
if (info.isDirectory()) {
|
|
21993
|
-
return { source: createDirectoryPluginFileSource(
|
|
23427
|
+
return { source: createDirectoryPluginFileSource(path14) };
|
|
21994
23428
|
}
|
|
21995
|
-
const bytes = new Uint8Array(await readFile(
|
|
23429
|
+
const bytes = new Uint8Array(await readFile(path14));
|
|
21996
23430
|
return {
|
|
21997
23431
|
source: await createZipPluginFileSource(bytes),
|
|
21998
23432
|
// The RAW central directory, read before the zip library normalizes it:
|
|
@@ -22102,17 +23536,17 @@ async function runOpenAICheck(target, options, command) {
|
|
|
22102
23536
|
const exitCode = directoryReadinessExitCode(result);
|
|
22103
23537
|
if (exitCode !== 0) setProcessExitCode(exitCode);
|
|
22104
23538
|
}
|
|
22105
|
-
async function readSubmissionProfile(
|
|
23539
|
+
async function readSubmissionProfile(path14) {
|
|
22106
23540
|
let text;
|
|
22107
23541
|
try {
|
|
22108
|
-
text = await readFile(
|
|
23542
|
+
text = await readFile(path14, "utf8");
|
|
22109
23543
|
} catch {
|
|
22110
|
-
throw usageError(`Cannot read --submission-profile ${
|
|
23544
|
+
throw usageError(`Cannot read --submission-profile ${path14}.`);
|
|
22111
23545
|
}
|
|
22112
23546
|
try {
|
|
22113
23547
|
return JSON.parse(text);
|
|
22114
23548
|
} catch {
|
|
22115
|
-
throw usageError(`--submission-profile ${
|
|
23549
|
+
throw usageError(`--submission-profile ${path14} is not valid JSON.`);
|
|
22116
23550
|
}
|
|
22117
23551
|
}
|
|
22118
23552
|
async function runMuseCheck(target, options, command) {
|
|
@@ -22212,6 +23646,8 @@ function registerReadinessCommands(program) {
|
|
|
22212
23646
|
await runMuseCheck(url, options, command);
|
|
22213
23647
|
});
|
|
22214
23648
|
registerHostedReadinessCommands(readiness);
|
|
23649
|
+
registerDirectorySubmissionCommands(readiness);
|
|
23650
|
+
registerReviewerAttemptCommands(readiness);
|
|
22215
23651
|
}
|
|
22216
23652
|
function registerHostedReadinessCommands(readiness) {
|
|
22217
23653
|
const start = readiness.command("start").description("Start a hosted readiness run against a saved server");
|
|
@@ -22302,11 +23738,21 @@ function registerHostedReadinessCommands(readiness) {
|
|
|
22302
23738
|
cancelReadinessRunOperation,
|
|
22303
23739
|
(options) => ({ project: options.project, run: options.run })
|
|
22304
23740
|
);
|
|
22305
|
-
const
|
|
23741
|
+
const resume = addProjectOption(
|
|
23742
|
+
readiness.command("resume").description(
|
|
23743
|
+
"Run again a hosted run that stopped on the server. Only the person who started it can."
|
|
23744
|
+
).requiredOption("--run <id>", "Readiness run id")
|
|
23745
|
+
);
|
|
23746
|
+
bindOperation(
|
|
23747
|
+
resume,
|
|
23748
|
+
resumeReadinessRunOperation,
|
|
23749
|
+
(options) => ({ project: options.project, run: options.run })
|
|
23750
|
+
);
|
|
23751
|
+
const report2 = addProjectOption(
|
|
22306
23752
|
readiness.command("report").description("Read a finished hosted run's findings").requiredOption("--run <id>", "Readiness run id")
|
|
22307
23753
|
);
|
|
22308
23754
|
bindOperation(
|
|
22309
|
-
|
|
23755
|
+
report2,
|
|
22310
23756
|
getReadinessReportOperation,
|
|
22311
23757
|
(options) => ({ project: options.project, run: options.run })
|
|
22312
23758
|
);
|
|
@@ -23121,6 +24567,8 @@ function registerServerCommands(program) {
|
|
|
23121
24567
|
});
|
|
23122
24568
|
const doctorTarget = summarizeServerDoctorTarget(target, config);
|
|
23123
24569
|
const result = await runServerDoctor({
|
|
24570
|
+
// The CLI counts the run itself, under its own opt-outs.
|
|
24571
|
+
__suppressTelemetry: true,
|
|
23124
24572
|
config,
|
|
23125
24573
|
target: doctorTarget,
|
|
23126
24574
|
timeout: globalOptions.timeout,
|
|
@@ -23919,6 +25367,7 @@ function registerSubscriptionsCommands(program) {
|
|
|
23919
25367
|
}
|
|
23920
25368
|
);
|
|
23921
25369
|
const onSignal = () => {
|
|
25370
|
+
recordCommandOutcome("interrupted");
|
|
23922
25371
|
void session.stop("signal");
|
|
23923
25372
|
};
|
|
23924
25373
|
process.on("SIGINT", onSignal);
|
|
@@ -24184,11 +25633,11 @@ function parseConformanceCheckIds(values) {
|
|
|
24184
25633
|
}
|
|
24185
25634
|
return [...new Set(ids)];
|
|
24186
25635
|
}
|
|
24187
|
-
function readPem(
|
|
25636
|
+
function readPem(path14, flag) {
|
|
24188
25637
|
try {
|
|
24189
|
-
return readFileSync(
|
|
25638
|
+
return readFileSync(path14, "utf8");
|
|
24190
25639
|
} catch (error) {
|
|
24191
|
-
throw usageError(`Cannot read ${flag} ${
|
|
25640
|
+
throw usageError(`Cannot read ${flag} ${path14}.`, {
|
|
24192
25641
|
source: error.code ?? String(error)
|
|
24193
25642
|
});
|
|
24194
25643
|
}
|
|
@@ -24218,18 +25667,18 @@ function planConformanceReceiver(options) {
|
|
|
24218
25667
|
let publicOrigin;
|
|
24219
25668
|
let insecure = !tls && insecureFlag;
|
|
24220
25669
|
if (options.publicUrl !== void 0) {
|
|
24221
|
-
const
|
|
25670
|
+
const checked2 = checkCallbackUrl(options.publicUrl, {
|
|
24222
25671
|
flag: "--public-url",
|
|
24223
25672
|
insecureFlag: "--insecure-local-receiver",
|
|
24224
25673
|
allowInsecure: insecureFlag
|
|
24225
25674
|
});
|
|
24226
|
-
if (
|
|
25675
|
+
if (checked2.url.pathname !== "/" || checked2.url.search || checked2.url.hash) {
|
|
24227
25676
|
throw usageError(
|
|
24228
25677
|
"--public-url must be a bare origin (the conformance receiver serves /i/<inbox>/s/<slot> at the root)."
|
|
24229
25678
|
);
|
|
24230
25679
|
}
|
|
24231
|
-
publicOrigin =
|
|
24232
|
-
insecure =
|
|
25680
|
+
publicOrigin = checked2.url.origin;
|
|
25681
|
+
insecure = checked2.insecure;
|
|
24233
25682
|
}
|
|
24234
25683
|
const listen = parseListenAddress(options.listen);
|
|
24235
25684
|
return {
|
|
@@ -24257,6 +25706,8 @@ async function runEventsConformanceForCli(args) {
|
|
|
24257
25706
|
);
|
|
24258
25707
|
}
|
|
24259
25708
|
return await runEventsConformance({
|
|
25709
|
+
// The CLI counts the run itself, under its own opt-outs.
|
|
25710
|
+
__suppressTelemetry: true,
|
|
24260
25711
|
manager: args.manager,
|
|
24261
25712
|
serverId: args.serverId,
|
|
24262
25713
|
profile: args.profile,
|
|
@@ -24283,9 +25734,9 @@ function renderEventsConformanceTable(result) {
|
|
|
24283
25734
|
`MCP Events conformance \u2014 profile ${result.profile}${result.protocolVersion ? `, protocol ${result.protocolVersion}` : ""}`
|
|
24284
25735
|
];
|
|
24285
25736
|
for (const check of result.checks) {
|
|
24286
|
-
const
|
|
25737
|
+
const note2 = check.status === "passed" ? "" : ` \u2014 ${check.skipReason ? `${check.skipReason}: ` : ""}${check.message}`;
|
|
24287
25738
|
lines.push(
|
|
24288
|
-
` ${STATUS_LABEL[check.status]} ${check.strength.padEnd(6)} ${check.id.padEnd(idWidth)} ${check.title}${
|
|
25739
|
+
` ${STATUS_LABEL[check.status]} ${check.strength.padEnd(6)} ${check.id.padEnd(idWidth)} ${check.title}${note2}`
|
|
24289
25740
|
);
|
|
24290
25741
|
}
|
|
24291
25742
|
const { passed, failed, warned, skipped } = result.summary;
|
|
@@ -24399,12 +25850,12 @@ async function startEventsReceiver(args) {
|
|
|
24399
25850
|
res.writeHead(status, { "content-type": "application/json", ...headers });
|
|
24400
25851
|
res.end(body === void 0 ? "" : JSON.stringify(body));
|
|
24401
25852
|
};
|
|
24402
|
-
const
|
|
24403
|
-
if (req.method === "GET" &&
|
|
25853
|
+
const path14 = (req.url ?? "/").split("?")[0] ?? "/";
|
|
25854
|
+
if (req.method === "GET" && path14 === "/.well-known/mcp-webhook-receiver.json") {
|
|
24404
25855
|
respond(200, { receivers: ["/i/"] });
|
|
24405
25856
|
return;
|
|
24406
25857
|
}
|
|
24407
|
-
const match = DELIVERY_PATH.exec(
|
|
25858
|
+
const match = DELIVERY_PATH.exec(path14);
|
|
24408
25859
|
if (req.method !== "POST" || !match) {
|
|
24409
25860
|
respond(404, { error: "not_found" });
|
|
24410
25861
|
return;
|
|
@@ -24809,16 +26260,16 @@ function planWatchReceiver(options) {
|
|
|
24809
26260
|
let publicUrl;
|
|
24810
26261
|
let insecure = options.insecureLocalReceiver === true && options.publicUrl === void 0;
|
|
24811
26262
|
if (options.publicUrl !== void 0) {
|
|
24812
|
-
const
|
|
26263
|
+
const checked2 = checkCallbackUrl(options.publicUrl, {
|
|
24813
26264
|
flag: "--public-url",
|
|
24814
26265
|
insecureFlag: "--insecure-local-receiver",
|
|
24815
26266
|
allowInsecure: options.insecureLocalReceiver === true
|
|
24816
26267
|
});
|
|
24817
|
-
if (
|
|
26268
|
+
if (checked2.url.search || checked2.url.hash) {
|
|
24818
26269
|
throw usageError("--public-url must not carry a query string or fragment.");
|
|
24819
26270
|
}
|
|
24820
|
-
publicUrl =
|
|
24821
|
-
insecure =
|
|
26271
|
+
publicUrl = checked2.url;
|
|
26272
|
+
insecure = checked2.insecure;
|
|
24822
26273
|
}
|
|
24823
26274
|
return {
|
|
24824
26275
|
forcedMode: "webhook",
|
|
@@ -24993,6 +26444,7 @@ function registerWatch(events) {
|
|
|
24993
26444
|
const onSignal = () => {
|
|
24994
26445
|
signals += 1;
|
|
24995
26446
|
if (signals === 1) {
|
|
26447
|
+
recordCommandOutcome("interrupted");
|
|
24996
26448
|
ctx.status("Stopping...");
|
|
24997
26449
|
session.stop("signal");
|
|
24998
26450
|
return;
|
|
@@ -25000,7 +26452,7 @@ function registerWatch(events) {
|
|
|
25000
26452
|
ctx.warn(
|
|
25001
26453
|
"Forced exit: the server subscription (if any) remains until its TTL expires."
|
|
25002
26454
|
);
|
|
25003
|
-
|
|
26455
|
+
void exitInterrupted();
|
|
25004
26456
|
};
|
|
25005
26457
|
process.on("SIGINT", onSignal);
|
|
25006
26458
|
process.on("SIGTERM", onSignal);
|
|
@@ -25330,6 +26782,7 @@ function registerConformance(events) {
|
|
|
25330
26782
|
)
|
|
25331
26783
|
);
|
|
25332
26784
|
}
|
|
26785
|
+
captureConformanceRunEvent("events", "single");
|
|
25333
26786
|
const result = await withEventsConnection(
|
|
25334
26787
|
options,
|
|
25335
26788
|
ctx,
|
|
@@ -25483,7 +26936,7 @@ async function runTaskAugmentedToolCall(args) {
|
|
|
25483
26936
|
yes: options.yes
|
|
25484
26937
|
});
|
|
25485
26938
|
const onState = options.taskWatch ? watchStateReporter(globalOptions) : void 0;
|
|
25486
|
-
const
|
|
26939
|
+
const note2 = (message) => {
|
|
25487
26940
|
if (!globalOptions.quiet) process.stderr.write(`${message}
|
|
25488
26941
|
`);
|
|
25489
26942
|
};
|
|
@@ -25535,7 +26988,7 @@ async function runTaskAugmentedToolCall(args) {
|
|
|
25535
26988
|
{ wire: support.wire, result }
|
|
25536
26989
|
);
|
|
25537
26990
|
}
|
|
25538
|
-
|
|
26991
|
+
note2(
|
|
25539
26992
|
`No task materialized: the server answered ${toolName} synchronously. Returning the tool result as-is.`
|
|
25540
26993
|
);
|
|
25541
26994
|
return { aborted: null, created: null, result };
|
|
@@ -26902,6 +28355,15 @@ function localTestExitCodeForResult(result, observed = {}) {
|
|
|
26902
28355
|
if (observed.artifactWriteFailed) codes.push(LOCAL_TEST_EXIT.setup);
|
|
26903
28356
|
return worstOf(codes);
|
|
26904
28357
|
}
|
|
28358
|
+
function recordLocalTestOutcome(exitCode) {
|
|
28359
|
+
if (exitCode === LOCAL_TEST_EXIT.passed || exitCode === LOCAL_TEST_EXIT.failed) {
|
|
28360
|
+
return;
|
|
28361
|
+
}
|
|
28362
|
+
recordCommandOutcome(
|
|
28363
|
+
"error",
|
|
28364
|
+
exitCode === LOCAL_TEST_EXIT.credentials ? "AUTH_FAILED" : exitCode === LOCAL_TEST_EXIT.usage ? "USAGE_ERROR" : void 0
|
|
28365
|
+
);
|
|
28366
|
+
}
|
|
26905
28367
|
|
|
26906
28368
|
// src/commands/test.ts
|
|
26907
28369
|
function collect4(value, previous = []) {
|
|
@@ -27121,6 +28583,7 @@ Received ${signal}; stopping and writing the partial report\u2026
|
|
|
27121
28583
|
`
|
|
27122
28584
|
);
|
|
27123
28585
|
}
|
|
28586
|
+
recordCommandOutcome("interrupted");
|
|
27124
28587
|
controller.abort(new Error(`interrupted by ${signal}`));
|
|
27125
28588
|
};
|
|
27126
28589
|
process.on("SIGINT", onSignal);
|
|
@@ -27203,6 +28666,7 @@ Received ${signal}; stopping and writing the partial report\u2026
|
|
|
27203
28666
|
if (error instanceof CliError) {
|
|
27204
28667
|
writeError(error, globalOptions.format);
|
|
27205
28668
|
setProcessExitCode(error.exitCode);
|
|
28669
|
+
recordCommandOutcome("error", error.code);
|
|
27206
28670
|
return;
|
|
27207
28671
|
}
|
|
27208
28672
|
throw error;
|
|
@@ -27244,6 +28708,10 @@ Received ${signal}; stopping and writing the partial report\u2026
|
|
|
27244
28708
|
} catch (error) {
|
|
27245
28709
|
writeError(error, globalOptions.format);
|
|
27246
28710
|
setProcessExitCode(LOCAL_TEST_EXIT.notEstablished);
|
|
28711
|
+
recordCommandOutcome(
|
|
28712
|
+
"error",
|
|
28713
|
+
error instanceof CliError ? error.code : void 0
|
|
28714
|
+
);
|
|
27247
28715
|
return;
|
|
27248
28716
|
}
|
|
27249
28717
|
if (!globalOptions.quiet) {
|
|
@@ -27256,6 +28724,7 @@ Received ${signal}; stopping and writing the partial report\u2026
|
|
|
27256
28724
|
artifactWriteFailed
|
|
27257
28725
|
});
|
|
27258
28726
|
setProcessExitCode(exitCode);
|
|
28727
|
+
recordLocalTestOutcome(exitCode);
|
|
27259
28728
|
}
|
|
27260
28729
|
);
|
|
27261
28730
|
}
|
|
@@ -27486,7 +28955,7 @@ async function requireBrowserConsentCapability(client) {
|
|
|
27486
28955
|
);
|
|
27487
28956
|
}
|
|
27488
28957
|
}
|
|
27489
|
-
async function post(options,
|
|
28958
|
+
async function post(options, path14, body, timeoutMs) {
|
|
27490
28959
|
if (options.cloud) {
|
|
27491
28960
|
if (options.inspectorUrl || options.consent)
|
|
27492
28961
|
throw usageError(
|
|
@@ -27499,14 +28968,14 @@ async function post(options, path12, body, timeoutMs) {
|
|
|
27499
28968
|
timeoutMs: timeoutMs ?? 12e4
|
|
27500
28969
|
});
|
|
27501
28970
|
return client2.browserSession(
|
|
27502
|
-
|
|
28971
|
+
path14.slice(1),
|
|
27503
28972
|
body
|
|
27504
28973
|
);
|
|
27505
28974
|
}
|
|
27506
28975
|
const client = new InspectorApiClient({ baseUrl: browserBaseUrl(options) });
|
|
27507
28976
|
const consentToken = consentOf(options);
|
|
27508
28977
|
await requireBrowserConsentCapability(client);
|
|
27509
|
-
const result = await client.request(`${BROWSER_ROUTE}${
|
|
28978
|
+
const result = await client.request(`${BROWSER_ROUTE}${path14}`, {
|
|
27510
28979
|
method: "POST",
|
|
27511
28980
|
body,
|
|
27512
28981
|
headers: { [BROWSER_CONSENT_HEADER]: consentToken },
|
|
@@ -28302,6 +29771,7 @@ function registerRegistryCommands(program) {
|
|
|
28302
29771
|
var pkgVersion = package_default.version;
|
|
28303
29772
|
async function main(argv = process.argv, dependencies = {}) {
|
|
28304
29773
|
process.exitCode = 0;
|
|
29774
|
+
resetCommandOutcome();
|
|
28305
29775
|
const program = addGlobalOptions(
|
|
28306
29776
|
new Command().name("mcpjam").version(pkgVersion, "-v, --version", "output the CLI version").description(
|
|
28307
29777
|
"Test, debug, and validate MCP servers locally, or manage MCPJam Cloud via `mcpjam cloud`. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI."
|
|
@@ -28353,10 +29823,8 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
28353
29823
|
restoreConsole();
|
|
28354
29824
|
}
|
|
28355
29825
|
const normalizedExitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
|
|
28356
|
-
|
|
28357
|
-
|
|
28358
|
-
normalizedExitCode === 0 ? void 0 : "UNKNOWN_ERROR"
|
|
28359
|
-
);
|
|
29826
|
+
const { outcome, errorCode } = resolveCommandOutcome(normalizedExitCode);
|
|
29827
|
+
captureCommandEvent(normalizedExitCode, outcome, errorCode);
|
|
28360
29828
|
await telemetry.flush();
|
|
28361
29829
|
return {
|
|
28362
29830
|
exitCode: normalizedExitCode,
|
|
@@ -28373,7 +29841,7 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
28373
29841
|
};
|
|
28374
29842
|
}
|
|
28375
29843
|
writeError(usageError(error.message), format);
|
|
28376
|
-
|
|
29844
|
+
captureUsageErrorEvent(argv);
|
|
28377
29845
|
await telemetry.flush();
|
|
28378
29846
|
return {
|
|
28379
29847
|
exitCode: 2,
|
|
@@ -28382,7 +29850,15 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
28382
29850
|
}
|
|
28383
29851
|
const normalizedError = normalizeCliError(error);
|
|
28384
29852
|
writeError(normalizedError, format);
|
|
28385
|
-
|
|
29853
|
+
if (normalizedError.code === "USAGE_ERROR") {
|
|
29854
|
+
captureUsageErrorEvent(argv, normalizedError.exitCode);
|
|
29855
|
+
} else {
|
|
29856
|
+
const { outcome, errorCode } = resolveCommandOutcome(
|
|
29857
|
+
normalizedError.exitCode,
|
|
29858
|
+
normalizedError.code
|
|
29859
|
+
);
|
|
29860
|
+
captureCommandEvent(normalizedError.exitCode, outcome, errorCode);
|
|
29861
|
+
}
|
|
28386
29862
|
await telemetry.flush();
|
|
28387
29863
|
return {
|
|
28388
29864
|
exitCode: normalizedError.exitCode,
|