@amerged/ohmyhost-mcp 0.1.20 → 0.1.22
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/{chunk-NESQZ3BS.js → chunk-NLBFEH6H.js} +13 -13
- package/dist/index.js +1 -1
- package/dist/stdio-main.js +126 -11
- package/package.json +8 -1
- package/src/apps/mcp/index.ts +5 -2
- package/src/apps/mcp/local-client.ts +33 -0
- package/src/apps/mcp/local-server.ts +48 -4
- package/src/apps/product-cli/cli.ts +33 -0
- package/src/apps/product-cli/command.ts +52 -0
- package/src/apps/product-cli/index.ts +2 -0
- package/src/apps/product-cli/product-api.ts +28 -0
- package/src/apps/product-cli/runtime-contract.ts +48 -3
- package/src/packages/agent-skills/generated-skill-resources.ts +10 -10
- package/src/packages/contracts/operation-failure.ts +3 -3
- package/src/packages/sdk-ts/generated/index.ts +21 -0
- package/src/packages/sdk-ts/generated/sdk.gen.ts +142 -0
- package/src/packages/sdk-ts/generated/types.gen.ts +200 -2
|
@@ -127,6 +127,11 @@ export type ProductCliCommand =
|
|
|
127
127
|
readonly organizationId: string;
|
|
128
128
|
readonly credentialStore: "native";
|
|
129
129
|
}
|
|
130
|
+
| {
|
|
131
|
+
readonly kind: "referral-link";
|
|
132
|
+
readonly organizationId: string;
|
|
133
|
+
readonly credentialStore: "native";
|
|
134
|
+
}
|
|
130
135
|
| {
|
|
131
136
|
readonly kind: "credits-balance";
|
|
132
137
|
readonly organizationId: string;
|
|
@@ -256,6 +261,18 @@ export type ProductCliCommand =
|
|
|
256
261
|
readonly projectId: string;
|
|
257
262
|
readonly credentialStore: "native";
|
|
258
263
|
}
|
|
264
|
+
| {
|
|
265
|
+
readonly kind: "project-flag-status";
|
|
266
|
+
readonly projectId: string;
|
|
267
|
+
readonly credentialStore: "native";
|
|
268
|
+
}
|
|
269
|
+
| {
|
|
270
|
+
readonly kind: "project-flag-set";
|
|
271
|
+
readonly projectId: string;
|
|
272
|
+
readonly enabled: boolean;
|
|
273
|
+
readonly idempotencyKey: string;
|
|
274
|
+
readonly credentialStore: "native";
|
|
275
|
+
}
|
|
259
276
|
| {
|
|
260
277
|
readonly kind: "database-write";
|
|
261
278
|
readonly projectId: string;
|
|
@@ -549,6 +566,7 @@ export type RecognizedCommandLabel =
|
|
|
549
566
|
| "version"
|
|
550
567
|
| "whoami"
|
|
551
568
|
| "credits account"
|
|
569
|
+
| "referral link"
|
|
552
570
|
| "credits balance"
|
|
553
571
|
| "credits usage"
|
|
554
572
|
| "budget get"
|
|
@@ -577,6 +595,8 @@ export type RecognizedCommandLabel =
|
|
|
577
595
|
| "project dev-share rotate"
|
|
578
596
|
| "project dev-share revoke"
|
|
579
597
|
| "project dev-access mode"
|
|
598
|
+
| "project flag status"
|
|
599
|
+
| "project flag set"
|
|
580
600
|
| "project handle check"
|
|
581
601
|
| "project handle set"
|
|
582
602
|
| "database write"
|
|
@@ -656,6 +676,7 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
656
676
|
if (value === "github" && values[0] === "status") return "github status";
|
|
657
677
|
if (value === "operation" && values[0] === "get") return "operation get";
|
|
658
678
|
if (value === "credits" && values[0] === "account") return "credits account";
|
|
679
|
+
if (value === "referral" && values[0] === "link") return "referral link";
|
|
659
680
|
if (value === "credits" && values[0] === "balance") return "credits balance";
|
|
660
681
|
if (value === "billing" && values[0] === "recharge" && values[1] === "get")
|
|
661
682
|
return "billing recharge get";
|
|
@@ -701,6 +722,10 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
701
722
|
return "project dev-access mode";
|
|
702
723
|
if (value === "project" && values[0] === "dev-access" && values[1] === "create")
|
|
703
724
|
return "project dev-access create";
|
|
725
|
+
if (value === "project" && values[0] === "flag" && values[1] === "status")
|
|
726
|
+
return "project flag status";
|
|
727
|
+
if (value === "project" && values[0] === "flag" && values[1] === "set")
|
|
728
|
+
return "project flag set";
|
|
704
729
|
if (value === "database" && values[0] === "compute" && values[1] === "set")
|
|
705
730
|
return "database compute set";
|
|
706
731
|
if (value === "database" && values[0] === "compute" && values[1] === "get")
|
|
@@ -1080,6 +1105,12 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
1080
1105
|
const options = parseOptions(values, ["--organization"]);
|
|
1081
1106
|
return { kind: "credits-account", organizationId: options["--organization"], credentialStore };
|
|
1082
1107
|
}
|
|
1108
|
+
if (first === "referral" && values[0] === "link") {
|
|
1109
|
+
values.shift();
|
|
1110
|
+
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
1111
|
+
const options = parseOptions(values, ["--organization"]);
|
|
1112
|
+
return { kind: "referral-link", organizationId: options["--organization"], credentialStore };
|
|
1113
|
+
}
|
|
1083
1114
|
if (first === "credits" && values.shift() === "balance") {
|
|
1084
1115
|
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
1085
1116
|
const options = parseOptions(values, ["--organization"]);
|
|
@@ -1266,6 +1297,27 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
1266
1297
|
credentialStore,
|
|
1267
1298
|
};
|
|
1268
1299
|
}
|
|
1300
|
+
if (subcommand === "flag") {
|
|
1301
|
+
const action = values.shift();
|
|
1302
|
+
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
1303
|
+
if (action === "status") {
|
|
1304
|
+
const options = parseOptions(values, ["--project"]);
|
|
1305
|
+
return { kind: "project-flag-status", projectId: options["--project"], credentialStore };
|
|
1306
|
+
}
|
|
1307
|
+
if (action === "set") {
|
|
1308
|
+
const options = parseOptions(values, ["--project", "--enabled", "--idempotency-key"]);
|
|
1309
|
+
if (options["--enabled"] !== "true" && options["--enabled"] !== "false")
|
|
1310
|
+
throw new InvalidCommandError();
|
|
1311
|
+
return {
|
|
1312
|
+
kind: "project-flag-set",
|
|
1313
|
+
projectId: options["--project"],
|
|
1314
|
+
enabled: options["--enabled"] === "true",
|
|
1315
|
+
idempotencyKey: options["--idempotency-key"],
|
|
1316
|
+
credentialStore,
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
throw new InvalidCommandError();
|
|
1320
|
+
}
|
|
1269
1321
|
if (subcommand === "dev-access" && values.shift() === "create") {
|
|
1270
1322
|
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
1271
1323
|
const options = parseOptions(values, ["--project"]);
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
type BillingPortal,
|
|
46
46
|
getOrganizationCredits,
|
|
47
47
|
getOrganizationAccount,
|
|
48
|
+
getOrganizationReferral,
|
|
48
49
|
type OrganizationAccount,
|
|
49
50
|
getOrganizationCreditUsage,
|
|
50
51
|
type OrganizationCreditUsage,
|
|
@@ -61,6 +62,8 @@ import {
|
|
|
61
62
|
rotateProjectDevShareLink,
|
|
62
63
|
revokeProjectDevShareLink,
|
|
63
64
|
setProjectDevAccessMode,
|
|
65
|
+
getProjectPoweredByFlag,
|
|
66
|
+
setProjectPoweredByFlag,
|
|
64
67
|
createDeployment,
|
|
65
68
|
createProject,
|
|
66
69
|
submitFeedback,
|
|
@@ -193,6 +196,9 @@ export interface ProductApi {
|
|
|
193
196
|
}): Promise<import("@ohmyhost/sdk-ts").BillingRecharge>;
|
|
194
197
|
createBillingPortal(organizationId: string): Promise<BillingPortal>;
|
|
195
198
|
getOrganizationAccount(organizationId: string): Promise<OrganizationAccount>;
|
|
199
|
+
getOrganizationReferral(
|
|
200
|
+
organizationId: string,
|
|
201
|
+
): Promise<import("@ohmyhost/sdk-ts").OrganizationReferral>;
|
|
196
202
|
getOrganizationCredits(organizationId: string): Promise<OrganizationCredits>;
|
|
197
203
|
getOrganizationCreditUsage(input: {
|
|
198
204
|
organizationId: string;
|
|
@@ -277,6 +283,12 @@ export interface ProductApi {
|
|
|
277
283
|
mode: "protected" | "public",
|
|
278
284
|
idempotencyKey: string,
|
|
279
285
|
): Promise<import("@ohmyhost/sdk-ts").DevAccessState>;
|
|
286
|
+
getPoweredByFlag(projectId: string): Promise<import("@ohmyhost/sdk-ts").PoweredByFlag>;
|
|
287
|
+
setPoweredByFlag(
|
|
288
|
+
projectId: string,
|
|
289
|
+
enabled: boolean,
|
|
290
|
+
idempotencyKey: string,
|
|
291
|
+
): Promise<import("@ohmyhost/sdk-ts").PoweredByFlag>;
|
|
280
292
|
submitFeedback(input: {
|
|
281
293
|
report: import("@ohmyhost/sdk-ts").FeedbackSubmission;
|
|
282
294
|
idempotencyKey: string;
|
|
@@ -489,6 +501,9 @@ export class GeneratedSdkProductApi implements ProductApi {
|
|
|
489
501
|
return parseAccountProfile(await getAccountProfile({ client: this.#client }));
|
|
490
502
|
}
|
|
491
503
|
|
|
504
|
+
public getOrganizationReferral(organizationId: string) {
|
|
505
|
+
return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
|
|
506
|
+
}
|
|
492
507
|
public getOrganizationAccount(organizationId: string) {
|
|
493
508
|
return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
|
|
494
509
|
}
|
|
@@ -790,6 +805,19 @@ export class GeneratedSdkProductApi implements ProductApi {
|
|
|
790
805
|
{ client: this.#client },
|
|
791
806
|
);
|
|
792
807
|
}
|
|
808
|
+
public async getPoweredByFlag(projectId: string) {
|
|
809
|
+
return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
|
|
810
|
+
}
|
|
811
|
+
public async setPoweredByFlag(projectId: string, enabled: boolean, idempotencyKey: string) {
|
|
812
|
+
return setProjectPoweredByFlag(
|
|
813
|
+
{
|
|
814
|
+
project_id: projectId,
|
|
815
|
+
"Idempotency-Key": idempotencyKey,
|
|
816
|
+
setPoweredByFlagRequest: { enabled },
|
|
817
|
+
},
|
|
818
|
+
{ client: this.#client },
|
|
819
|
+
);
|
|
820
|
+
}
|
|
793
821
|
public async createDevAccessTicket(projectId: string): Promise<DevAccessTicket> {
|
|
794
822
|
return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
|
|
795
823
|
}
|
|
@@ -273,6 +273,12 @@ export const PROBLEM_POLICY = {
|
|
|
273
273
|
retryable: false,
|
|
274
274
|
action: "Finish database provisioning, then request the export again. No backup was accepted.",
|
|
275
275
|
},
|
|
276
|
+
powered_by_flag_required: {
|
|
277
|
+
status: 409,
|
|
278
|
+
retryable: false,
|
|
279
|
+
action:
|
|
280
|
+
"Keep the flag on, remove the custom domain with 'ohmyhost domain paid delete', or buy Paid, then switch the flag off.",
|
|
281
|
+
},
|
|
276
282
|
rate_limited: { status: 429, retryable: true, action: "Retry after the server delay." },
|
|
277
283
|
insufficient_organization_credits: {
|
|
278
284
|
status: 402,
|
|
@@ -289,7 +295,7 @@ export const PROBLEM_POLICY = {
|
|
|
289
295
|
status: 402,
|
|
290
296
|
retryable: false,
|
|
291
297
|
action:
|
|
292
|
-
"Ask the organization Owner to activate Paid through billing checkout, then retry. Top-ups and signup credits do not activate Paid.",
|
|
298
|
+
"Ask the organization Owner to activate Paid through billing checkout, then retry. Top-ups and signup credits do not activate Paid. For a website domain alone, a Free workspace may instead show the powered-by flag on the project.",
|
|
293
299
|
},
|
|
294
300
|
interactive_login_required: {
|
|
295
301
|
status: 403,
|
|
@@ -740,6 +746,39 @@ export const parseDevAccessState = (value: unknown): PublicDevAccessState => {
|
|
|
740
746
|
return input as unknown as PublicDevAccessState;
|
|
741
747
|
};
|
|
742
748
|
|
|
749
|
+
export interface PublicPoweredByFlag {
|
|
750
|
+
readonly project_id: string;
|
|
751
|
+
readonly enabled: boolean;
|
|
752
|
+
readonly enabled_at: string | null;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
export const parsePoweredByFlag = (value: unknown): PublicPoweredByFlag => {
|
|
756
|
+
const input = exactRecord(value, ["project_id", "enabled", "enabled_at"]);
|
|
757
|
+
if (
|
|
758
|
+
!isUlid(input["project_id"]) ||
|
|
759
|
+
typeof input["enabled"] !== "boolean" ||
|
|
760
|
+
(input["enabled"] ? !isIsoInstant(input["enabled_at"]) : input["enabled_at"] !== null)
|
|
761
|
+
)
|
|
762
|
+
throw new ResponseContractError();
|
|
763
|
+
return input as unknown as PublicPoweredByFlag;
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
export interface PublicOrganizationReferral {
|
|
767
|
+
readonly organization_id: string;
|
|
768
|
+
readonly referral_url: string;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export const parseOrganizationReferral = (value: unknown): PublicOrganizationReferral => {
|
|
772
|
+
const input = exactRecord(value, ["organization_id", "referral_url"]);
|
|
773
|
+
if (
|
|
774
|
+
!isUlid(input["organization_id"]) ||
|
|
775
|
+
input["referral_url"] !==
|
|
776
|
+
`https://ohmyho.st/?r=ref-${String(input["organization_id"]).toLowerCase()}`
|
|
777
|
+
)
|
|
778
|
+
throw new ResponseContractError();
|
|
779
|
+
return input as unknown as PublicOrganizationReferral;
|
|
780
|
+
};
|
|
781
|
+
|
|
743
782
|
export const parseDevAccessTicket = (value: unknown): PublicDevAccessTicket => {
|
|
744
783
|
const input = exactRecord(value, [
|
|
745
784
|
"ticket_id",
|
|
@@ -1141,6 +1180,8 @@ const parseProjectDeployment = (value: unknown): void => {
|
|
|
1141
1180
|
|
|
1142
1181
|
export interface PublicOperation {
|
|
1143
1182
|
readonly blocking_operation_id?: string;
|
|
1183
|
+
/** The deployment this operation created; its diagnostics explain a failure. */
|
|
1184
|
+
readonly deployment_id?: string;
|
|
1144
1185
|
readonly progress?: OperationDeploymentProgress;
|
|
1145
1186
|
readonly id: string;
|
|
1146
1187
|
readonly state: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
@@ -1580,6 +1621,7 @@ export const parseSafeProblem = (value: unknown): SafeProblem => {
|
|
|
1580
1621
|
export const parseOperation = (value: unknown): PublicOperation => {
|
|
1581
1622
|
const input = exactRecord(value, [
|
|
1582
1623
|
"blocking_operation_id",
|
|
1624
|
+
"deployment_id",
|
|
1583
1625
|
"id",
|
|
1584
1626
|
"state",
|
|
1585
1627
|
"created_at",
|
|
@@ -1595,9 +1637,11 @@ export const parseOperation = (value: unknown): PublicOperation => {
|
|
|
1595
1637
|
const updatedAt = input["updated_at"];
|
|
1596
1638
|
const result = input["result"];
|
|
1597
1639
|
const blockingOperationId = input["blocking_operation_id"];
|
|
1640
|
+
const deploymentId = input["deployment_id"];
|
|
1598
1641
|
if (
|
|
1599
|
-
blockingOperationId !== undefined &&
|
|
1600
|
-
|
|
1642
|
+
(blockingOperationId !== undefined &&
|
|
1643
|
+
(state !== "queued" || !isUlid(blockingOperationId) || blockingOperationId === id)) ||
|
|
1644
|
+
(deploymentId !== undefined && !isUlid(deploymentId))
|
|
1601
1645
|
)
|
|
1602
1646
|
throw new ResponseContractError();
|
|
1603
1647
|
if (
|
|
@@ -1659,6 +1703,7 @@ export const parseOperation = (value: unknown): PublicOperation => {
|
|
|
1659
1703
|
...(blockingOperationId === undefined
|
|
1660
1704
|
? {}
|
|
1661
1705
|
: { blocking_operation_id: blockingOperationId as string }),
|
|
1706
|
+
...(deploymentId === undefined ? {} : { deployment_id: deploymentId as string }),
|
|
1662
1707
|
...(progress === undefined ? {} : { progress }),
|
|
1663
1708
|
...(result === undefined ? {} : { result }),
|
|
1664
1709
|
...(error === undefined ? {} : { error }),
|