wp-typia 0.22.3 → 0.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-bunli/.bunli/commands.gen.js +2098 -2027
- package/dist-bunli/{cli-sj5mtyzj.js → cli-6bhfzq5e.js} +41 -2
- package/dist-bunli/{cli-add-p3re8act.js → cli-add-1gqgshf0.js} +211 -395
- package/dist-bunli/{cli-pd5pqgre.js → cli-btbpt84c.js} +6 -11
- package/dist-bunli/{cli-tbd9x8b6.js → cli-ctddkm3n.js} +138 -12
- package/dist-bunli/{cli-doctor-cjm4rzbk.js → cli-doctor-w35s8y9w.js} +9 -64
- package/dist-bunli/{cli-gcbre1zs.js → cli-hb9vpsev.js} +6 -13
- package/dist-bunli/{cli-init-7gcthyn1.js → cli-init-z8sjmkvc.js} +11 -11
- package/dist-bunli/{cli-x0h03qqe.js → cli-j30rk466.js} +1406 -1304
- package/dist-bunli/{cli-mpgt29xc.js → cli-nzwpmw4y.js} +124 -38
- package/dist-bunli/cli-rwjkqjhs.js +88 -0
- package/dist-bunli/{cli-scaffold-x1dp8sz1.js → cli-scaffold-ad3bd555.js} +10 -10
- package/dist-bunli/{cli-prc42zqd.js → cli-xbzfx7qz.js} +7 -7
- package/dist-bunli/cli.js +7 -4
- package/dist-bunli/{command-list-wzej5c7v.js → command-list-scd6zqp8.js} +69 -132
- package/dist-bunli/{migrations-xfb2h7nf.js → migrations-skkzdvhm.js} +5 -5
- package/dist-bunli/node-cli.js +199 -221
- package/dist-bunli/{workspace-project-gxb499cp.js → workspace-project-7826tewa.js} +3 -2
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
package_default,
|
|
19
19
|
prefersStructuredCliOutput,
|
|
20
20
|
resolveCommandOptionValues
|
|
21
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-nzwpmw4y.js";
|
|
22
22
|
import {
|
|
23
23
|
Result,
|
|
24
24
|
TaggedError,
|
|
@@ -32,9 +32,6 @@ import {
|
|
|
32
32
|
useRuntime
|
|
33
33
|
} from "./cli-hv2yedw2.js";
|
|
34
34
|
import"./cli-ac2ebaf8.js";
|
|
35
|
-
import {
|
|
36
|
-
formatPackageExecCommand
|
|
37
|
-
} from "./cli-sj5mtyzj.js";
|
|
38
35
|
import {
|
|
39
36
|
createManagedTempRoot
|
|
40
37
|
} from "./cli-t73q5aqz.js";
|
|
@@ -42,6 +39,12 @@ import {
|
|
|
42
39
|
CLI_DIAGNOSTIC_CODES,
|
|
43
40
|
createCliDiagnosticCodeError
|
|
44
41
|
} from "./cli-p95wr1q8.js";
|
|
42
|
+
import {
|
|
43
|
+
formatInstallCommand,
|
|
44
|
+
formatPackageExecCommand,
|
|
45
|
+
formatRunScript,
|
|
46
|
+
inferPackageManagerId
|
|
47
|
+
} from "./cli-6bhfzq5e.js";
|
|
45
48
|
import {
|
|
46
49
|
__require,
|
|
47
50
|
__toESM
|
|
@@ -206,6 +209,18 @@ function createNamedExecutionPlan(context, options) {
|
|
|
206
209
|
function isAddPersistenceTemplate(template) {
|
|
207
210
|
return template === "persistence" || template === "compound";
|
|
208
211
|
}
|
|
212
|
+
function formatAddBlockTemplateIds(addRuntime) {
|
|
213
|
+
return addRuntime.ADD_BLOCK_TEMPLATE_IDS.join(", ");
|
|
214
|
+
}
|
|
215
|
+
function assertAddBlockTemplateId(context, templateId) {
|
|
216
|
+
if (context.addRuntime.isAddBlockTemplateId(templateId)) {
|
|
217
|
+
return templateId;
|
|
218
|
+
}
|
|
219
|
+
if (templateId === "query-loop") {
|
|
220
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
|
|
221
|
+
}
|
|
222
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
|
|
223
|
+
}
|
|
209
224
|
var ADD_KIND_REGISTRY = {
|
|
210
225
|
"admin-view": defineAddKindRegistryEntry({
|
|
211
226
|
completion: {
|
|
@@ -312,7 +327,8 @@ var ADD_KIND_REGISTRY = {
|
|
|
312
327
|
const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
|
|
313
328
|
const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
|
|
314
329
|
const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
|
|
315
|
-
|
|
330
|
+
const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
|
|
331
|
+
let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
|
|
316
332
|
if (!resolvedTemplateId && context.isInteractiveSession) {
|
|
317
333
|
const templatePrompt = await context.getOrCreatePrompt();
|
|
318
334
|
resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
|
|
@@ -828,7 +844,7 @@ async function simulateWorkspaceAddDryRun({
|
|
|
828
844
|
cwd,
|
|
829
845
|
execute
|
|
830
846
|
}) {
|
|
831
|
-
const { resolveWorkspaceProject } = await import("./workspace-project-
|
|
847
|
+
const { resolveWorkspaceProject } = await import("./workspace-project-7826tewa.js");
|
|
832
848
|
const workspace = resolveWorkspaceProject(cwd);
|
|
833
849
|
const relativeCwd = path.relative(workspace.projectDir, path.resolve(cwd));
|
|
834
850
|
const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-add-plan-");
|
|
@@ -848,10 +864,6 @@ async function simulateWorkspaceAddDryRun({
|
|
|
848
864
|
}
|
|
849
865
|
}
|
|
850
866
|
|
|
851
|
-
// src/runtime-bridge-output.ts
|
|
852
|
-
import fs3 from "fs";
|
|
853
|
-
import path2 from "path";
|
|
854
|
-
|
|
855
867
|
// src/output-markers.ts
|
|
856
868
|
var UNICODE_OUTPUT_MARKERS = {
|
|
857
869
|
dryRun: "\uD83E\uDDEA",
|
|
@@ -1097,32 +1109,6 @@ function buildInitCompletionPayload(plan, markerOptions) {
|
|
|
1097
1109
|
warningLines: plan.notes
|
|
1098
1110
|
};
|
|
1099
1111
|
}
|
|
1100
|
-
function inferProjectPackageManager(projectDir) {
|
|
1101
|
-
try {
|
|
1102
|
-
const packageJsonPath = path2.join(projectDir, "package.json");
|
|
1103
|
-
if (fs3.existsSync(packageJsonPath)) {
|
|
1104
|
-
const manifest = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1105
|
-
if (manifest.packageManager?.startsWith("bun@"))
|
|
1106
|
-
return "bun";
|
|
1107
|
-
if (manifest.packageManager?.startsWith("pnpm@"))
|
|
1108
|
-
return "pnpm";
|
|
1109
|
-
if (manifest.packageManager?.startsWith("yarn@"))
|
|
1110
|
-
return "yarn";
|
|
1111
|
-
if (manifest.packageManager?.startsWith("npm@"))
|
|
1112
|
-
return "npm";
|
|
1113
|
-
}
|
|
1114
|
-
} catch {}
|
|
1115
|
-
if (fs3.existsSync(path2.join(projectDir, "bun.lock")) || fs3.existsSync(path2.join(projectDir, "bun.lockb"))) {
|
|
1116
|
-
return "bun";
|
|
1117
|
-
}
|
|
1118
|
-
if (fs3.existsSync(path2.join(projectDir, "pnpm-lock.yaml"))) {
|
|
1119
|
-
return "pnpm";
|
|
1120
|
-
}
|
|
1121
|
-
if (fs3.existsSync(path2.join(projectDir, "yarn.lock")) || fs3.existsSync(path2.join(projectDir, ".yarnrc.yml"))) {
|
|
1122
|
-
return "yarn";
|
|
1123
|
-
}
|
|
1124
|
-
return "npm";
|
|
1125
|
-
}
|
|
1126
1112
|
function buildMigrationCompletionPayload(options, markerOptions) {
|
|
1127
1113
|
const summaryLines = options.lines.filter((line) => line.trim().length > 0);
|
|
1128
1114
|
return {
|
|
@@ -1132,7 +1118,7 @@ function buildMigrationCompletionPayload(options, markerOptions) {
|
|
|
1132
1118
|
}
|
|
1133
1119
|
function buildAddCompletionPayload(options, markerOptions) {
|
|
1134
1120
|
const verificationLines = [
|
|
1135
|
-
formatPackageExecCommand(options.packageManager ??
|
|
1121
|
+
formatPackageExecCommand(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
|
|
1136
1122
|
];
|
|
1137
1123
|
const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
|
|
1138
1124
|
const completion = buildAddKindCompletionDetails(options.kind, {
|
|
@@ -1197,8 +1183,8 @@ function supportsInteractiveTui(options = {}) {
|
|
|
1197
1183
|
}
|
|
1198
1184
|
// src/runtime-bridge-sync.ts
|
|
1199
1185
|
import { spawnSync } from "child_process";
|
|
1200
|
-
import
|
|
1201
|
-
import
|
|
1186
|
+
import fs3 from "fs";
|
|
1187
|
+
import path2 from "path";
|
|
1202
1188
|
var SYNC_INSTALL_MARKERS = [
|
|
1203
1189
|
"node_modules",
|
|
1204
1190
|
".pnp.cjs",
|
|
@@ -1215,64 +1201,15 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
1215
1201
|
}
|
|
1216
1202
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
1217
1203
|
}
|
|
1218
|
-
function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
|
|
1219
|
-
const args = extraArgs.trim();
|
|
1220
|
-
if (packageManagerId === "bun") {
|
|
1221
|
-
return args ? `bun run ${scriptName} ${args}` : `bun run ${scriptName}`;
|
|
1222
|
-
}
|
|
1223
|
-
if (packageManagerId === "npm") {
|
|
1224
|
-
return args ? `npm run ${scriptName} -- ${args}` : `npm run ${scriptName}`;
|
|
1225
|
-
}
|
|
1226
|
-
if (packageManagerId === "pnpm") {
|
|
1227
|
-
return args ? `pnpm run ${scriptName} ${args}` : `pnpm run ${scriptName}`;
|
|
1228
|
-
}
|
|
1229
|
-
return args ? `yarn run ${scriptName} ${args}` : `yarn run ${scriptName}`;
|
|
1230
|
-
}
|
|
1231
|
-
function formatInstallCommand(packageManagerId) {
|
|
1232
|
-
switch (packageManagerId) {
|
|
1233
|
-
case "bun":
|
|
1234
|
-
return "bun install";
|
|
1235
|
-
case "pnpm":
|
|
1236
|
-
return "pnpm install";
|
|
1237
|
-
case "yarn":
|
|
1238
|
-
return "yarn install";
|
|
1239
|
-
default:
|
|
1240
|
-
return "npm install";
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
1204
|
function getSyncRootError(cwd) {
|
|
1244
1205
|
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.OUTSIDE_PROJECT_ROOT, `No generated wp-typia project root was found at ${cwd}. Run \`wp-typia sync\` from a scaffolded project or official workspace root that already contains generated sync scripts. If you expected this directory to work, cd into the scaffold root first or rerun the scaffold before syncing.`);
|
|
1245
1206
|
}
|
|
1246
|
-
function inferSyncPackageManager(cwd, packageManagerField) {
|
|
1247
|
-
const field = String(packageManagerField ?? "");
|
|
1248
|
-
if (field.startsWith("bun@"))
|
|
1249
|
-
return "bun";
|
|
1250
|
-
if (field.startsWith("npm@"))
|
|
1251
|
-
return "npm";
|
|
1252
|
-
if (field.startsWith("pnpm@"))
|
|
1253
|
-
return "pnpm";
|
|
1254
|
-
if (field.startsWith("yarn@"))
|
|
1255
|
-
return "yarn";
|
|
1256
|
-
if (fs4.existsSync(path3.join(cwd, "bun.lock")) || fs4.existsSync(path3.join(cwd, "bun.lockb"))) {
|
|
1257
|
-
return "bun";
|
|
1258
|
-
}
|
|
1259
|
-
if (fs4.existsSync(path3.join(cwd, "pnpm-lock.yaml"))) {
|
|
1260
|
-
return "pnpm";
|
|
1261
|
-
}
|
|
1262
|
-
if (fs4.existsSync(path3.join(cwd, "yarn.lock")) || fs4.existsSync(path3.join(cwd, ".pnp.cjs")) || fs4.existsSync(path3.join(cwd, ".pnp.loader.mjs")) || fs4.existsSync(path3.join(cwd, ".yarnrc.yml"))) {
|
|
1263
|
-
return "yarn";
|
|
1264
|
-
}
|
|
1265
|
-
if (fs4.existsSync(path3.join(cwd, "package-lock.json")) || fs4.existsSync(path3.join(cwd, "npm-shrinkwrap.json"))) {
|
|
1266
|
-
return "npm";
|
|
1267
|
-
}
|
|
1268
|
-
return "npm";
|
|
1269
|
-
}
|
|
1270
1207
|
function resolveSyncProjectContext(cwd) {
|
|
1271
|
-
const packageJsonPath =
|
|
1272
|
-
if (!
|
|
1208
|
+
const packageJsonPath = path2.join(cwd, "package.json");
|
|
1209
|
+
if (!fs3.existsSync(packageJsonPath)) {
|
|
1273
1210
|
throw getSyncRootError(cwd);
|
|
1274
1211
|
}
|
|
1275
|
-
const packageJson = JSON.parse(
|
|
1212
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1276
1213
|
const scripts = packageJson.scripts ?? {};
|
|
1277
1214
|
const syncScripts = {
|
|
1278
1215
|
sync: typeof scripts.sync === "string" ? {
|
|
@@ -1298,17 +1235,17 @@ function resolveSyncProjectContext(cwd) {
|
|
|
1298
1235
|
return {
|
|
1299
1236
|
cwd,
|
|
1300
1237
|
packageJsonPath,
|
|
1301
|
-
packageManager:
|
|
1238
|
+
packageManager: inferPackageManagerId(cwd, packageJson.packageManager),
|
|
1302
1239
|
scripts: syncScripts
|
|
1303
1240
|
};
|
|
1304
1241
|
}
|
|
1305
1242
|
function findInstalledDependencyMarkerDir(projectDir) {
|
|
1306
|
-
let currentDir =
|
|
1243
|
+
let currentDir = path2.resolve(projectDir);
|
|
1307
1244
|
while (true) {
|
|
1308
|
-
if (SYNC_INSTALL_MARKERS.some((marker) =>
|
|
1245
|
+
if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path2.join(currentDir, marker)))) {
|
|
1309
1246
|
return currentDir;
|
|
1310
1247
|
}
|
|
1311
|
-
const parentDir =
|
|
1248
|
+
const parentDir = path2.dirname(currentDir);
|
|
1312
1249
|
if (parentDir === currentDir) {
|
|
1313
1250
|
return null;
|
|
1314
1251
|
}
|
|
@@ -1443,14 +1380,14 @@ async function executeSyncCommand({
|
|
|
1443
1380
|
}
|
|
1444
1381
|
|
|
1445
1382
|
// src/runtime-bridge.ts
|
|
1446
|
-
var loadCliAddRuntime = () => import("./cli-add-
|
|
1383
|
+
var loadCliAddRuntime = () => import("./cli-add-1gqgshf0.js");
|
|
1447
1384
|
var loadCliDiagnosticsRuntime = () => import("./cli-diagnostics-5dvztm7q.js");
|
|
1448
|
-
var loadCliDoctorRuntime = () => import("./cli-doctor-
|
|
1449
|
-
var loadCliInitRuntime = () => import("./cli-init-
|
|
1385
|
+
var loadCliDoctorRuntime = () => import("./cli-doctor-w35s8y9w.js");
|
|
1386
|
+
var loadCliInitRuntime = () => import("./cli-init-z8sjmkvc.js");
|
|
1450
1387
|
var loadCliPromptRuntime = () => import("./cli-prompt-614tq57c.js");
|
|
1451
|
-
var loadCliScaffoldRuntime = () => import("./cli-scaffold-
|
|
1388
|
+
var loadCliScaffoldRuntime = () => import("./cli-scaffold-ad3bd555.js");
|
|
1452
1389
|
var loadCliTemplatesRuntime = () => import("./cli-templates-9t2a7zqd.js");
|
|
1453
|
-
var loadMigrationsRuntime = () => import("./migrations-
|
|
1390
|
+
var loadMigrationsRuntime = () => import("./migrations-skkzdvhm.js");
|
|
1454
1391
|
async function wrapCliCommandError(command, error) {
|
|
1455
1392
|
const { createCliCommandError } = await loadCliDiagnosticsRuntime();
|
|
1456
1393
|
return createCliCommandError({ command, error });
|
|
@@ -2398,7 +2335,7 @@ var doctorCommand = defineCommand({
|
|
|
2398
2335
|
const prefersStructuredOutput = prefersStructuredCliOutput(args);
|
|
2399
2336
|
if (prefersStructuredOutput) {
|
|
2400
2337
|
const [{ getDoctorChecks }, { getDoctorFailureDetailLines }] = await Promise.all([
|
|
2401
|
-
import("./cli-doctor-
|
|
2338
|
+
import("./cli-doctor-w35s8y9w.js"),
|
|
2402
2339
|
import("./cli-diagnostics-5dvztm7q.js")
|
|
2403
2340
|
]);
|
|
2404
2341
|
const checks = await getDoctorChecks(args.cwd);
|
|
@@ -2456,8 +2393,8 @@ var initCommand = defineCommand({
|
|
|
2456
2393
|
});
|
|
2457
2394
|
|
|
2458
2395
|
// src/mcp.ts
|
|
2459
|
-
import
|
|
2460
|
-
import
|
|
2396
|
+
import fs4 from "fs/promises";
|
|
2397
|
+
import path3 from "path";
|
|
2461
2398
|
|
|
2462
2399
|
// ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
|
|
2463
2400
|
class SchemaConversionError extends TaggedError("SchemaConversionError")() {
|
|
@@ -2476,7 +2413,7 @@ class McpToolsProviderError extends TaggedError("McpToolsProviderError")() {
|
|
|
2476
2413
|
function jsonSchemaToZodSchema(schema, options = {}) {
|
|
2477
2414
|
return convertSchema(schema, options, "$");
|
|
2478
2415
|
}
|
|
2479
|
-
function convertSchema(schema, options,
|
|
2416
|
+
function convertSchema(schema, options, path3) {
|
|
2480
2417
|
const { coerce = true } = options;
|
|
2481
2418
|
if (!schema || typeof schema !== "object") {
|
|
2482
2419
|
return Result.ok(exports_external.unknown());
|
|
@@ -2491,49 +2428,49 @@ function convertSchema(schema, options, path4) {
|
|
|
2491
2428
|
return Result.ok(exports_external.enum(enumValues));
|
|
2492
2429
|
}
|
|
2493
2430
|
const literals = enumValues.map((v) => exports_external.literal(v));
|
|
2494
|
-
return unionFromSchemas(literals,
|
|
2431
|
+
return unionFromSchemas(literals, path3);
|
|
2495
2432
|
}
|
|
2496
2433
|
}
|
|
2497
2434
|
if (schema.anyOf && schema.anyOf.length > 0) {
|
|
2498
|
-
const schemas = mapSchemas(schema.anyOf, options, `${
|
|
2435
|
+
const schemas = mapSchemas(schema.anyOf, options, `${path3}.anyOf`);
|
|
2499
2436
|
if (Result.isError(schemas)) {
|
|
2500
2437
|
return schemas;
|
|
2501
2438
|
}
|
|
2502
|
-
return unionFromSchemas(schemas.value, `${
|
|
2439
|
+
return unionFromSchemas(schemas.value, `${path3}.anyOf`);
|
|
2503
2440
|
}
|
|
2504
2441
|
if (schema.oneOf && schema.oneOf.length > 0) {
|
|
2505
|
-
const schemas = mapSchemas(schema.oneOf, options, `${
|
|
2442
|
+
const schemas = mapSchemas(schema.oneOf, options, `${path3}.oneOf`);
|
|
2506
2443
|
if (Result.isError(schemas)) {
|
|
2507
2444
|
return schemas;
|
|
2508
2445
|
}
|
|
2509
|
-
return unionFromSchemas(schemas.value, `${
|
|
2446
|
+
return unionFromSchemas(schemas.value, `${path3}.oneOf`);
|
|
2510
2447
|
}
|
|
2511
2448
|
const schemaType = Array.isArray(schema.type) ? schema.type[0] : schema.type;
|
|
2512
2449
|
switch (schemaType) {
|
|
2513
2450
|
case "string":
|
|
2514
|
-
return buildStringSchema(schema,
|
|
2451
|
+
return buildStringSchema(schema, path3);
|
|
2515
2452
|
case "number":
|
|
2516
2453
|
case "integer":
|
|
2517
2454
|
return Result.ok(buildNumberSchema(schema, coerce));
|
|
2518
2455
|
case "boolean":
|
|
2519
2456
|
return Result.ok(buildBooleanSchema());
|
|
2520
2457
|
case "array":
|
|
2521
|
-
return buildArraySchema(schema, options,
|
|
2458
|
+
return buildArraySchema(schema, options, path3);
|
|
2522
2459
|
case "object":
|
|
2523
|
-
return buildObjectSchema(schema, options,
|
|
2460
|
+
return buildObjectSchema(schema, options, path3);
|
|
2524
2461
|
case "null":
|
|
2525
2462
|
return Result.ok(exports_external.null());
|
|
2526
2463
|
default:
|
|
2527
2464
|
if (schema.properties) {
|
|
2528
|
-
return buildObjectSchema(schema, options,
|
|
2465
|
+
return buildObjectSchema(schema, options, path3);
|
|
2529
2466
|
}
|
|
2530
2467
|
if (schema.items) {
|
|
2531
|
-
return buildArraySchema(schema, options,
|
|
2468
|
+
return buildArraySchema(schema, options, path3);
|
|
2532
2469
|
}
|
|
2533
2470
|
return Result.ok(exports_external.unknown());
|
|
2534
2471
|
}
|
|
2535
2472
|
}
|
|
2536
|
-
function buildStringSchema(schema,
|
|
2473
|
+
function buildStringSchema(schema, path3) {
|
|
2537
2474
|
let zodSchema = exports_external.string();
|
|
2538
2475
|
if (schema.minLength !== undefined) {
|
|
2539
2476
|
zodSchema = zodSchema.min(schema.minLength);
|
|
@@ -2546,7 +2483,7 @@ function buildStringSchema(schema, path4) {
|
|
|
2546
2483
|
const regexResult = Result.try({
|
|
2547
2484
|
try: () => new RegExp(pattern),
|
|
2548
2485
|
catch: (cause) => new SchemaConversionError({
|
|
2549
|
-
path:
|
|
2486
|
+
path: path3,
|
|
2550
2487
|
message: `Invalid regex pattern "${pattern}"`,
|
|
2551
2488
|
cause
|
|
2552
2489
|
})
|
|
@@ -2603,19 +2540,19 @@ function buildNumberSchema(schema, coerce) {
|
|
|
2603
2540
|
function buildBooleanSchema() {
|
|
2604
2541
|
return exports_external.boolean();
|
|
2605
2542
|
}
|
|
2606
|
-
function buildArraySchema(schema, options,
|
|
2543
|
+
function buildArraySchema(schema, options, path3) {
|
|
2607
2544
|
let itemSchema = exports_external.unknown();
|
|
2608
2545
|
if (schema.items) {
|
|
2609
2546
|
if (Array.isArray(schema.items)) {
|
|
2610
2547
|
if (schema.items.length > 0) {
|
|
2611
|
-
const itemResult = convertSchema(schema.items[0], options, `${
|
|
2548
|
+
const itemResult = convertSchema(schema.items[0], options, `${path3}.items[0]`);
|
|
2612
2549
|
if (Result.isError(itemResult)) {
|
|
2613
2550
|
return itemResult;
|
|
2614
2551
|
}
|
|
2615
2552
|
itemSchema = itemResult.value;
|
|
2616
2553
|
}
|
|
2617
2554
|
} else {
|
|
2618
|
-
const itemResult = convertSchema(schema.items, options, `${
|
|
2555
|
+
const itemResult = convertSchema(schema.items, options, `${path3}.items`);
|
|
2619
2556
|
if (Result.isError(itemResult)) {
|
|
2620
2557
|
return itemResult;
|
|
2621
2558
|
}
|
|
@@ -2631,14 +2568,14 @@ function buildArraySchema(schema, options, path4) {
|
|
|
2631
2568
|
}
|
|
2632
2569
|
return Result.ok(zodSchema);
|
|
2633
2570
|
}
|
|
2634
|
-
function buildObjectSchema(schema, options,
|
|
2571
|
+
function buildObjectSchema(schema, options, path3) {
|
|
2635
2572
|
if (!schema.properties) {
|
|
2636
2573
|
return Result.ok(exports_external.record(exports_external.string(), exports_external.unknown()));
|
|
2637
2574
|
}
|
|
2638
2575
|
const shape = {};
|
|
2639
2576
|
const requiredFields = new Set(schema.required || []);
|
|
2640
2577
|
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
2641
|
-
const propResult = convertSchema(propSchema, options, `${
|
|
2578
|
+
const propResult = convertSchema(propSchema, options, `${path3}.properties.${propName}`);
|
|
2642
2579
|
if (Result.isError(propResult)) {
|
|
2643
2580
|
return propResult;
|
|
2644
2581
|
}
|
|
@@ -2653,10 +2590,10 @@ function buildObjectSchema(schema, options, path4) {
|
|
|
2653
2590
|
}
|
|
2654
2591
|
return Result.ok(exports_external.object(shape));
|
|
2655
2592
|
}
|
|
2656
|
-
function mapSchemas(schemas, options,
|
|
2593
|
+
function mapSchemas(schemas, options, path3) {
|
|
2657
2594
|
const zodSchemas = [];
|
|
2658
2595
|
for (let index = 0;index < schemas.length; index += 1) {
|
|
2659
|
-
const converted = convertSchema(schemas[index], options, `${
|
|
2596
|
+
const converted = convertSchema(schemas[index], options, `${path3}[${index}]`);
|
|
2660
2597
|
if (Result.isError(converted)) {
|
|
2661
2598
|
return converted;
|
|
2662
2599
|
}
|
|
@@ -2664,11 +2601,11 @@ function mapSchemas(schemas, options, path4) {
|
|
|
2664
2601
|
}
|
|
2665
2602
|
return Result.ok(zodSchemas);
|
|
2666
2603
|
}
|
|
2667
|
-
function unionFromSchemas(schemas,
|
|
2604
|
+
function unionFromSchemas(schemas, path3) {
|
|
2668
2605
|
if (schemas.length === 0) {
|
|
2669
2606
|
return Result.err(new SchemaConversionError({
|
|
2670
|
-
path:
|
|
2671
|
-
message: `Cannot create union from an empty schema set at ${
|
|
2607
|
+
path: path3,
|
|
2608
|
+
message: `Cannot create union from an empty schema set at ${path3}`,
|
|
2672
2609
|
cause: new Error("Empty schema union")
|
|
2673
2610
|
}));
|
|
2674
2611
|
}
|
|
@@ -2985,8 +2922,8 @@ function isToolGroup(value) {
|
|
|
2985
2922
|
return isObject(value) && typeof value.namespace === "string" && Array.isArray(value.tools) && value.tools.every(isTool);
|
|
2986
2923
|
}
|
|
2987
2924
|
async function readSchemaSource(cwd, source) {
|
|
2988
|
-
const schemaPath =
|
|
2989
|
-
const raw = await
|
|
2925
|
+
const schemaPath = path3.resolve(cwd, source.path);
|
|
2926
|
+
const raw = await fs4.readFile(schemaPath, "utf8");
|
|
2990
2927
|
const parsed = JSON.parse(raw);
|
|
2991
2928
|
if (isToolGroup(parsed)) {
|
|
2992
2929
|
return parsed;
|
|
@@ -3002,7 +2939,7 @@ async function readSchemaSource(cwd, source) {
|
|
|
3002
2939
|
async function loadMcpToolGroups(cwd, schemaSources) {
|
|
3003
2940
|
return Promise.all(schemaSources.map((source) => readSchemaSource(cwd, source)));
|
|
3004
2941
|
}
|
|
3005
|
-
async function syncMcpSchemas(cwd, schemaSources, outputDir =
|
|
2942
|
+
async function syncMcpSchemas(cwd, schemaSources, outputDir = path3.join(cwd, ".bunli", "mcp")) {
|
|
3006
2943
|
const groups = await loadMcpToolGroups(cwd, schemaSources);
|
|
3007
2944
|
const result = await generateMCPTypes({
|
|
3008
2945
|
outputDir,
|
|
@@ -3024,8 +2961,8 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path4.join(cwd, ".
|
|
|
3024
2961
|
throw convert.error;
|
|
3025
2962
|
}
|
|
3026
2963
|
}
|
|
3027
|
-
await
|
|
3028
|
-
await
|
|
2964
|
+
await fs4.mkdir(outputDir, { recursive: true });
|
|
2965
|
+
await fs4.writeFile(path3.join(outputDir, "registry.json"), `${JSON.stringify(registry, null, 2)}
|
|
3029
2966
|
`, "utf8");
|
|
3030
2967
|
return {
|
|
3031
2968
|
commandCount: registry.reduce((count, group) => count + group.tools.length, 0),
|
|
@@ -3264,4 +3201,4 @@ export {
|
|
|
3264
3201
|
wpTypiaCommands
|
|
3265
3202
|
};
|
|
3266
3203
|
|
|
3267
|
-
//# debugId=
|
|
3204
|
+
//# debugId=72FB605118CF0EEA64756E2164756E21
|
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
snapshotProjectVersion,
|
|
16
16
|
verifyProjectMigrations,
|
|
17
17
|
wizardProjectMigrations
|
|
18
|
-
} from "./cli-
|
|
19
|
-
import"./cli-
|
|
18
|
+
} from "./cli-xbzfx7qz.js";
|
|
19
|
+
import"./cli-hb9vpsev.js";
|
|
20
20
|
import"./cli-bq2v559b.js";
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
23
|
-
import"./cli-
|
|
21
|
+
import"./cli-j30rk466.js";
|
|
22
|
+
import"./cli-btbpt84c.js";
|
|
23
|
+
import"./cli-6bhfzq5e.js";
|
|
24
24
|
import"./cli-xnn9xjcy.js";
|
|
25
25
|
export {
|
|
26
26
|
wizardProjectMigrations,
|