@amerged/ohmyhost-mcp 0.1.33 → 0.1.35
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-YM2ZQAGS.js → chunk-CVTJZFHD.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/stdio-main.js +66 -18
- package/package.json +1 -1
- package/src/apps/mcp/package.json +1 -1
- package/src/apps/mcp/src/local-server.ts +16 -4
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +1 -1
- package/src/apps/product-cli/src/repository-init.ts +45 -10
- package/src/apps/product-cli/src/runtime-contract.ts +26 -2
- package/src/packages/agent-skills/src/generated-skill-resources.ts +4 -4
- package/src/packages/contracts/src/framework-admission.ts +32 -6
- package/src/packages/contracts/src/framework-build-script.mjs +8 -2
- package/src/packages/contracts/src/framework-family.ts +4 -0
- package/src/packages/contracts/src/framework-source-rules.ts +78 -9
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +1 -1
- package/src/packages/sdk-ts/src/generated/types.gen.ts +15 -1
|
@@ -40,7 +40,12 @@ export const WORKER_MODULE_PATH = "src/ohmyhost/worker.ts" as const;
|
|
|
40
40
|
/** The Worker module of a Vite application with a server runtime. */
|
|
41
41
|
export const VITE_COMPANION_ENTRY_PATH = "src/ohmyhost/companion.ts" as const;
|
|
42
42
|
|
|
43
|
-
export type FrameworkSourceFramework =
|
|
43
|
+
export type FrameworkSourceFramework =
|
|
44
|
+
| "astro"
|
|
45
|
+
| "functions"
|
|
46
|
+
| "nextjs"
|
|
47
|
+
| "tanstack-start"
|
|
48
|
+
| "vite-static";
|
|
44
49
|
export type PackageManifest = Readonly<Record<string, unknown>>;
|
|
45
50
|
/**
|
|
46
51
|
* Where package.json may declare a dependency: `runtime` only in dependencies, `build` also in
|
|
@@ -91,6 +96,7 @@ const DEPENDENCY_FIELDS = Object.freeze({
|
|
|
91
96
|
// Next.js and TanStack Start load their runtime packages in the server bundle, so package.json
|
|
92
97
|
// declares them in dependencies; Vite and its plugins only build, so devDependencies suffice.
|
|
93
98
|
const REQUIRED_DEPENDENCIES = Object.freeze({
|
|
99
|
+
astro: Object.freeze([["astro", "build"]] as const),
|
|
94
100
|
nextjs: Object.freeze([
|
|
95
101
|
["next", "runtime"],
|
|
96
102
|
["react", "runtime"],
|
|
@@ -109,6 +115,7 @@ const REQUIRED_DEPENDENCIES = Object.freeze({
|
|
|
109
115
|
} satisfies Record<FrameworkSourceFramework, readonly (readonly [string, DependencyPlacement])[]>);
|
|
110
116
|
const TANSTACK_EDGE_DEPENDENCY = Object.freeze([CLOUDFLARE_PLUGIN, "build"] as const);
|
|
111
117
|
const BUILD_SCRIPT_FRAMEWORKS = Object.freeze({
|
|
118
|
+
astro: "astro",
|
|
112
119
|
nextjs: "nextjs",
|
|
113
120
|
"vite-static": "vite",
|
|
114
121
|
"tanstack-start": "tanstack-start",
|
|
@@ -118,7 +125,11 @@ const BUILD_OUTPUTS: Readonly<Partial<Record<FrameworkSourceFramework, string>>>
|
|
|
118
125
|
"tanstack-start": "dist/client",
|
|
119
126
|
});
|
|
120
127
|
const REQUIRED_CONFIG_PATHS: Readonly<Partial<Record<FrameworkSourceFramework, string>>> =
|
|
121
|
-
Object.freeze({
|
|
128
|
+
Object.freeze({
|
|
129
|
+
astro: "astro.config.mjs",
|
|
130
|
+
nextjs: "next.config.ts",
|
|
131
|
+
"tanstack-start": "vite.config.ts",
|
|
132
|
+
});
|
|
122
133
|
// The PostCSS configuration the Next.js Webpack build reads: package.json "postcss" or one of these
|
|
123
134
|
// files at the application root. It never reads a TypeScript one such as postcss.config.ts.
|
|
124
135
|
const POSTCSS_CONFIG_PATH = /^(?:postcss\.config\.(?:[cm]?js|json)|\.postcssrc\.(?:js|json))$/u;
|
|
@@ -214,7 +225,10 @@ export function frameworkVersionAdmissions(
|
|
|
214
225
|
): readonly FrameworkVersionAdmission[] {
|
|
215
226
|
const admissions: FrameworkVersionAdmission[] = [];
|
|
216
227
|
let locked: ((packageName: string) => string | null) | undefined;
|
|
217
|
-
for (const [name, placement] of
|
|
228
|
+
for (const [name, placement] of framework === "astro" &&
|
|
229
|
+
declaredDependency(manifest, "@astrojs/cloudflare", "build") !== null
|
|
230
|
+
? [...REQUIRED_DEPENDENCIES.astro, ["@astrojs/cloudflare", "build"] as const]
|
|
231
|
+
: REQUIRED_DEPENDENCIES[framework]) {
|
|
218
232
|
if (!isFrameworkVersionPackage(name)) continue;
|
|
219
233
|
const declared = declaredDependency(manifest, name, placement);
|
|
220
234
|
if (declared === null) continue;
|
|
@@ -504,7 +518,7 @@ export function sourceWithoutComments(source: string): string {
|
|
|
504
518
|
* extensions planning reads, without TypeScript declaration files, which never run.
|
|
505
519
|
*/
|
|
506
520
|
export function isDatabaseContractModule(path: string): boolean {
|
|
507
|
-
return /\.(?:ts|tsx|js|jsx|mjs|mts)$/u.test(path) && !/\.d\.[cm]?ts$/u.test(path);
|
|
521
|
+
return /\.(?:astro|ts|tsx|js|jsx|mjs|mts)$/u.test(path) && !/\.d\.[cm]?ts$/u.test(path);
|
|
508
522
|
}
|
|
509
523
|
|
|
510
524
|
function manifestFindings(
|
|
@@ -524,9 +538,11 @@ function manifestFindings(
|
|
|
524
538
|
diagnostic({ code: "build_script_unsupported", path: PACKAGE_MANIFEST, framework }),
|
|
525
539
|
);
|
|
526
540
|
const required =
|
|
527
|
-
framework === "
|
|
528
|
-
? [...REQUIRED_DEPENDENCIES[
|
|
529
|
-
:
|
|
541
|
+
framework === "astro" && configuration.runtime.mode === "edge"
|
|
542
|
+
? [...REQUIRED_DEPENDENCIES.astro, ["@astrojs/cloudflare", "build"] as const]
|
|
543
|
+
: framework === "tanstack-start" && configuration.runtime.mode === "edge"
|
|
544
|
+
? [...REQUIRED_DEPENDENCIES[framework], TANSTACK_EDGE_DEPENDENCY]
|
|
545
|
+
: REQUIRED_DEPENDENCIES[framework];
|
|
530
546
|
for (const [name, placement] of required)
|
|
531
547
|
if (declaredDependency(manifest, name, placement) === null)
|
|
532
548
|
findings.push(
|
|
@@ -567,7 +583,12 @@ function configurationFindings(input: FrameworkSourceRuleInput): FrameworkConver
|
|
|
567
583
|
);
|
|
568
584
|
if (build !== null && framework !== "nextjs" && build.ssg_cache_max_mib !== undefined)
|
|
569
585
|
findings.push(diagnostic({ code: "build_option_unsupported", path: REPOSITORY_CONFIG }));
|
|
570
|
-
const output =
|
|
586
|
+
const output =
|
|
587
|
+
framework === "astro"
|
|
588
|
+
? configuration.runtime.mode === "edge"
|
|
589
|
+
? "dist/client"
|
|
590
|
+
: "dist"
|
|
591
|
+
: BUILD_OUTPUTS[framework];
|
|
571
592
|
if (build !== null && output !== undefined && build.output !== output)
|
|
572
593
|
findings.push(
|
|
573
594
|
diagnostic({ code: "build_output_unsupported", path: REPOSITORY_CONFIG, framework }),
|
|
@@ -592,6 +613,7 @@ function configurationFindings(input: FrameworkSourceRuleInput): FrameworkConver
|
|
|
592
613
|
(framework === "functions" ||
|
|
593
614
|
(crons &&
|
|
594
615
|
(framework === "nextjs" ||
|
|
616
|
+
(framework === "astro" && configuration.runtime.mode === "edge") ||
|
|
595
617
|
(framework === "tanstack-start" && configuration.runtime.mode === "edge")))) &&
|
|
596
618
|
!files.includes(WORKER_MODULE_PATH)
|
|
597
619
|
)
|
|
@@ -607,6 +629,16 @@ function runtimeModeAdmitted(
|
|
|
607
629
|
crons: boolean,
|
|
608
630
|
): boolean {
|
|
609
631
|
const mode = configuration.runtime.mode;
|
|
632
|
+
if (framework === "astro")
|
|
633
|
+
return (
|
|
634
|
+
mode === "edge" ||
|
|
635
|
+
(mode === "static" &&
|
|
636
|
+
!crons &&
|
|
637
|
+
configuration.storage === undefined &&
|
|
638
|
+
configuration.database?.enabled !== true &&
|
|
639
|
+
configuration.mail?.enabled !== true &&
|
|
640
|
+
configuration.auth?.provider !== "better-auth")
|
|
641
|
+
);
|
|
610
642
|
if (framework === "nextjs") return mode === "edge";
|
|
611
643
|
if (framework === "vite-static")
|
|
612
644
|
return mode === (viteCompanionRequired(configuration) ? "edge" : "static");
|
|
@@ -629,6 +661,8 @@ function frameworkConfigFindings(
|
|
|
629
661
|
const { frameworkConfig, framework } = input;
|
|
630
662
|
if (frameworkConfig === null || framework === "functions") return [];
|
|
631
663
|
const { path, text } = frameworkConfig;
|
|
664
|
+
if (framework === "astro")
|
|
665
|
+
return astroConfigFindings(text, path, input.configuration.runtime.mode);
|
|
632
666
|
if (framework === "nextjs") return nextConfigFindings(text, path, hasPostcssConfiguration(input));
|
|
633
667
|
if (framework === "vite-static") return viteConfigFindings(text, path);
|
|
634
668
|
const mode = input.configuration.runtime.mode;
|
|
@@ -660,7 +694,14 @@ function frameworkConfigPath(
|
|
|
660
694
|
): string | null {
|
|
661
695
|
if (framework === "functions") return null;
|
|
662
696
|
const path = admitted(findings, () =>
|
|
663
|
-
resolveFrameworkConfig(
|
|
697
|
+
resolveFrameworkConfig(
|
|
698
|
+
framework === "astro"
|
|
699
|
+
? "astro.config"
|
|
700
|
+
: framework === "nextjs"
|
|
701
|
+
? "next.config"
|
|
702
|
+
: "vite.config",
|
|
703
|
+
files,
|
|
704
|
+
),
|
|
664
705
|
);
|
|
665
706
|
if (framework === "nextjs")
|
|
666
707
|
admitted(findings, () => resolveFrameworkConfig("open-next.config", files));
|
|
@@ -1116,3 +1157,31 @@ function hasModuleImport(tokens: readonly ConfigToken[], moduleName: string): bo
|
|
|
1116
1157
|
tokens[index + 1]?.value === moduleName,
|
|
1117
1158
|
);
|
|
1118
1159
|
}
|
|
1160
|
+
|
|
1161
|
+
/** Astro's build validates executable config; admission rejects known incompatible contracts. */
|
|
1162
|
+
function astroConfigFindings(
|
|
1163
|
+
text: string,
|
|
1164
|
+
path: string,
|
|
1165
|
+
mode: string,
|
|
1166
|
+
): readonly FrameworkConversionDiagnostic[] {
|
|
1167
|
+
const lexed = lexFrameworkConfig(text, path);
|
|
1168
|
+
if ("finding" in lexed) return [lexed.finding];
|
|
1169
|
+
const tokens = lexed.tokens;
|
|
1170
|
+
const hasPropertyKey = (items: readonly ConfigToken[], name: string) =>
|
|
1171
|
+
items.some((token, index) => token.value === name && items[index + 1]?.value === ":");
|
|
1172
|
+
const invalid =
|
|
1173
|
+
hasNonRootProperty(tokens, ["base"], ["", "/"]) ||
|
|
1174
|
+
["srcDir", "outDir", "serverEntry", "client", "server", "assetsPrefix"].some((name) =>
|
|
1175
|
+
hasPropertyKey(tokens, name),
|
|
1176
|
+
) ||
|
|
1177
|
+
(mode === "edge"
|
|
1178
|
+
? !text.includes("@astrojs/cloudflare") ||
|
|
1179
|
+
!hasProperty(tokens, "output", "server") ||
|
|
1180
|
+
!hasProperty(tokens, "session", "false") ||
|
|
1181
|
+
!hasProperty(tokens, "imageService", "passthrough") ||
|
|
1182
|
+
hasPropertyKey(tokens, "cache")
|
|
1183
|
+
: text.includes("@astrojs/cloudflare") ||
|
|
1184
|
+
hasPropertyKey(tokens, "adapter") ||
|
|
1185
|
+
hasProperty(tokens, "output", "server"));
|
|
1186
|
+
return invalid ? [diagnostic({ code: "astro_config_unsupported", path })] : [];
|
|
1187
|
+
}
|
|
@@ -945,7 +945,7 @@ export const completeCloudflareDnsAuthorization = <ThrowOnError extends boolean
|
|
|
945
945
|
/**
|
|
946
946
|
* Get the current authenticated identity
|
|
947
947
|
*
|
|
948
|
-
* Returns the stable ohmyhost actor and
|
|
948
|
+
* Returns the stable ohmyhost actor, the current user's or API-key owner's email, and the credential's organization scope with current display names. Machine-to-machine credentials have a null email. Organizations match organization_ids in the same order.
|
|
949
949
|
*/
|
|
950
950
|
export const getCurrentIdentity = <ThrowOnError extends boolean = true>(
|
|
951
951
|
parameters?: {
|
|
@@ -1148,11 +1148,25 @@ export type OrganizationAccount = {
|
|
|
1148
1148
|
};
|
|
1149
1149
|
|
|
1150
1150
|
/**
|
|
1151
|
-
*
|
|
1151
|
+
* Customer-visible current account and credential organization scope for authenticated agent clients.
|
|
1152
1152
|
*/
|
|
1153
1153
|
export type CurrentIdentity = {
|
|
1154
1154
|
actor_id: string;
|
|
1155
|
+
/**
|
|
1156
|
+
* Email of the current user or user API-key owner; null for machine-to-machine credentials.
|
|
1157
|
+
*/
|
|
1158
|
+
email: string | null;
|
|
1155
1159
|
organization_ids: Array<Ulid>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Current names for exactly the organization_ids scope, in the same order.
|
|
1162
|
+
*/
|
|
1163
|
+
organizations: Array<{
|
|
1164
|
+
id: Ulid;
|
|
1165
|
+
/**
|
|
1166
|
+
* Current organization display name without surrounding whitespace or ASCII control characters.
|
|
1167
|
+
*/
|
|
1168
|
+
name: string;
|
|
1169
|
+
}>;
|
|
1156
1170
|
};
|
|
1157
1171
|
|
|
1158
1172
|
export type Project = {
|