wp-typia 0.22.3 → 0.22.4

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.
@@ -0,0 +1,88 @@
1
+ // @bun
2
+ // ../wp-typia-project-tools/src/runtime/ts-source-masking.ts
3
+ function maskSourceSegment(segment) {
4
+ return segment.replace(/[^\n\r]/gu, " ");
5
+ }
6
+ function testPattern(source, pattern) {
7
+ pattern.lastIndex = 0;
8
+ const matched = pattern.test(source);
9
+ pattern.lastIndex = 0;
10
+ return matched;
11
+ }
12
+ function maskTypeScriptComments(source) {
13
+ return source.replace(/\/\*[\s\S]*?\*\//gu, maskSourceSegment).replace(/\/\/[^\n\r]*/gu, maskSourceSegment);
14
+ }
15
+ function maskTypeScriptCommentsAndLiterals(source) {
16
+ let maskedSource = "";
17
+ let index = 0;
18
+ while (index < source.length) {
19
+ const current = source[index];
20
+ const next = source[index + 1];
21
+ if (current === "/" && next === "/") {
22
+ const start = index;
23
+ index += 2;
24
+ while (index < source.length && source[index] !== `
25
+ ` && source[index] !== "\r") {
26
+ index += 1;
27
+ }
28
+ maskedSource += maskSourceSegment(source.slice(start, index));
29
+ continue;
30
+ }
31
+ if (current === "/" && next === "*") {
32
+ const start = index;
33
+ index += 2;
34
+ while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) {
35
+ index += 1;
36
+ }
37
+ index = Math.min(index + 2, source.length);
38
+ maskedSource += maskSourceSegment(source.slice(start, index));
39
+ continue;
40
+ }
41
+ if (current === "'" || current === '"' || current === "`") {
42
+ const start = index;
43
+ const quote = current;
44
+ index += 1;
45
+ while (index < source.length) {
46
+ const char = source[index];
47
+ if (char === "\\") {
48
+ index += 2;
49
+ continue;
50
+ }
51
+ index += 1;
52
+ if (char === quote) {
53
+ break;
54
+ }
55
+ }
56
+ maskedSource += maskSourceSegment(source.slice(start, index));
57
+ continue;
58
+ }
59
+ maskedSource += current;
60
+ index += 1;
61
+ }
62
+ return maskedSource;
63
+ }
64
+ function hasExecutablePattern(source, pattern) {
65
+ return testPattern(maskTypeScriptCommentsAndLiterals(source), pattern);
66
+ }
67
+ function hasUncommentedPattern(source, pattern) {
68
+ return testPattern(maskTypeScriptComments(source), pattern);
69
+ }
70
+ function findExecutablePatternMatch(source, patterns) {
71
+ const maskedSource = maskTypeScriptCommentsAndLiterals(source);
72
+ for (const pattern of patterns) {
73
+ pattern.lastIndex = 0;
74
+ const match = pattern.exec(maskedSource);
75
+ pattern.lastIndex = 0;
76
+ if (match && match.index !== undefined) {
77
+ return {
78
+ end: match.index + match[0].length,
79
+ start: match.index
80
+ };
81
+ }
82
+ }
83
+ return;
84
+ }
85
+
86
+ export { maskTypeScriptCommentsAndLiterals, hasExecutablePattern, hasUncommentedPattern, findExecutablePatternMatch };
87
+
88
+ //# debugId=752C0F7611E9866D64756E2164756E21
@@ -19,26 +19,26 @@ import {
19
19
  resolvePackageManagerId,
20
20
  resolveTemplateId,
21
21
  scaffoldProject
22
- } from "./cli-tbd9x8b6.js";
22
+ } from "./cli-6ymn63t4.js";
23
23
  import"./cli-1sm60g1z.js";
24
- import"./cli-prc42zqd.js";
25
- import"./cli-gcbre1zs.js";
24
+ import"./cli-2mt6bvcj.js";
25
+ import"./cli-hb9vpsev.js";
26
26
  import"./cli-bq2v559b.js";
27
- import {
28
- formatInstallCommand,
29
- formatRunScript
30
- } from "./cli-sj5mtyzj.js";
31
27
  import"./cli-10pe4mf8.js";
32
28
  import {
33
29
  OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,
34
30
  isBuiltInTemplateId
35
31
  } from "./cli-tke8twkn.js";
36
- import"./cli-x0h03qqe.js";
32
+ import"./cli-qr2ek735.js";
37
33
  import {
38
34
  createManagedTempRoot
39
35
  } from "./cli-t73q5aqz.js";
40
36
  import"./cli-p95wr1q8.js";
41
- import"./cli-pd5pqgre.js";
37
+ import"./cli-btbpt84c.js";
38
+ import {
39
+ formatInstallCommand,
40
+ formatRunScript
41
+ } from "./cli-6bhfzq5e.js";
42
42
  import"./cli-xnn9xjcy.js";
43
43
 
44
44
  // ../wp-typia-project-tools/src/runtime/cli-scaffold.ts
@@ -556,4 +556,4 @@ export {
556
556
  getNextSteps
557
557
  };
558
558
 
559
- //# debugId=F96DC2979B837E5864756E2164756E21
559
+ //# debugId=C9BCDEC89787F16964756E2164756E21
package/dist-bunli/cli.js CHANGED
@@ -18,8 +18,9 @@ import {
18
18
  loadWpTypiaUserConfigFromSource,
19
19
  mergeWpTypiaUserConfig,
20
20
  package_default,
21
+ validateCliOutputFormatArgv,
21
22
  writeStructuredCliDiagnosticError
22
- } from "./cli-mpgt29xc.js";
23
+ } from "./cli-gsj6vyn5.js";
23
24
  import"./cli-03j0axbt.js";
24
25
  import {
25
26
  GLOBAL_FLAGS,
@@ -2453,7 +2454,7 @@ async function formatCliError(error) {
2453
2454
  }
2454
2455
  async function createWpTypiaCli(options = {}) {
2455
2456
  applyStandaloneSupportLayoutEnv();
2456
- const { wpTypiaCommands } = await import("./command-list-wzej5c7v.js");
2457
+ const { wpTypiaCommands } = await import("./command-list-wsaa4t2p.js");
2457
2458
  const cli = await createCLI({
2458
2459
  ...bunliConfig,
2459
2460
  description: package_default.description,
@@ -2487,6 +2488,7 @@ async function createWpTypiaCli(options = {}) {
2487
2488
  async function main(argv = process.argv.slice(2)) {
2488
2489
  const normalizedArgv = normalizeWpTypiaArgv(argv);
2489
2490
  const { argv: cliArgv, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
2491
+ validateCliOutputFormatArgv(cliArgv);
2490
2492
  const cli = await createWpTypiaCli({ configOverridePath });
2491
2493
  await cli.run(cliArgv);
2492
2494
  }
@@ -2512,4 +2514,4 @@ export {
2512
2514
  createWpTypiaCli
2513
2515
  };
2514
2516
 
2515
- //# debugId=5EFFD418326B0BAA64756E2164756E21
2517
+ //# debugId=CF070B64D3FCE30F64756E2164756E21
@@ -18,7 +18,7 @@ import {
18
18
  package_default,
19
19
  prefersStructuredCliOutput,
20
20
  resolveCommandOptionValues
21
- } from "./cli-mpgt29xc.js";
21
+ } from "./cli-gsj6vyn5.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
- let resolvedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
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-gxb499cp.js");
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 ?? inferProjectPackageManager(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
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 fs4 from "fs";
1201
- import path3 from "path";
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 = path3.join(cwd, "package.json");
1272
- if (!fs4.existsSync(packageJsonPath)) {
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(fs4.readFileSync(packageJsonPath, "utf8"));
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: inferSyncPackageManager(cwd, packageJson.packageManager),
1238
+ packageManager: inferPackageManagerId(cwd, packageJson.packageManager),
1302
1239
  scripts: syncScripts
1303
1240
  };
1304
1241
  }
1305
1242
  function findInstalledDependencyMarkerDir(projectDir) {
1306
- let currentDir = path3.resolve(projectDir);
1243
+ let currentDir = path2.resolve(projectDir);
1307
1244
  while (true) {
1308
- if (SYNC_INSTALL_MARKERS.some((marker) => fs4.existsSync(path3.join(currentDir, marker)))) {
1245
+ if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path2.join(currentDir, marker)))) {
1309
1246
  return currentDir;
1310
1247
  }
1311
- const parentDir = path3.dirname(currentDir);
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-p3re8act.js");
1383
+ var loadCliAddRuntime = () => import("./cli-add-6s6kzf7x.js");
1447
1384
  var loadCliDiagnosticsRuntime = () => import("./cli-diagnostics-5dvztm7q.js");
1448
- var loadCliDoctorRuntime = () => import("./cli-doctor-cjm4rzbk.js");
1449
- var loadCliInitRuntime = () => import("./cli-init-7gcthyn1.js");
1385
+ var loadCliDoctorRuntime = () => import("./cli-doctor-70zd5m3b.js");
1386
+ var loadCliInitRuntime = () => import("./cli-init-kjjyky1y.js");
1450
1387
  var loadCliPromptRuntime = () => import("./cli-prompt-614tq57c.js");
1451
- var loadCliScaffoldRuntime = () => import("./cli-scaffold-x1dp8sz1.js");
1388
+ var loadCliScaffoldRuntime = () => import("./cli-scaffold-f57ccf5v.js");
1452
1389
  var loadCliTemplatesRuntime = () => import("./cli-templates-9t2a7zqd.js");
1453
- var loadMigrationsRuntime = () => import("./migrations-xfb2h7nf.js");
1390
+ var loadMigrationsRuntime = () => import("./migrations-vw502qf9.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-cjm4rzbk.js"),
2338
+ import("./cli-doctor-70zd5m3b.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 fs5 from "fs/promises";
2460
- import path4 from "path";
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, path4) {
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, path4);
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, `${path4}.anyOf`);
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, `${path4}.anyOf`);
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, `${path4}.oneOf`);
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, `${path4}.oneOf`);
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, path4);
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, path4);
2458
+ return buildArraySchema(schema, options, path3);
2522
2459
  case "object":
2523
- return buildObjectSchema(schema, options, path4);
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, path4);
2465
+ return buildObjectSchema(schema, options, path3);
2529
2466
  }
2530
2467
  if (schema.items) {
2531
- return buildArraySchema(schema, options, path4);
2468
+ return buildArraySchema(schema, options, path3);
2532
2469
  }
2533
2470
  return Result.ok(exports_external.unknown());
2534
2471
  }
2535
2472
  }
2536
- function buildStringSchema(schema, path4) {
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: path4,
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, path4) {
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, `${path4}.items[0]`);
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, `${path4}.items`);
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, path4) {
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, `${path4}.properties.${propName}`);
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, path4) {
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, `${path4}[${index}]`);
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, path4) {
2604
+ function unionFromSchemas(schemas, path3) {
2668
2605
  if (schemas.length === 0) {
2669
2606
  return Result.err(new SchemaConversionError({
2670
- path: path4,
2671
- message: `Cannot create union from an empty schema set at ${path4}`,
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 = path4.resolve(cwd, source.path);
2989
- const raw = await fs5.readFile(schemaPath, "utf8");
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 = path4.join(cwd, ".bunli", "mcp")) {
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 fs5.mkdir(outputDir, { recursive: true });
3028
- await fs5.writeFile(path4.join(outputDir, "registry.json"), `${JSON.stringify(registry, null, 2)}
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=73FFE6511B0A672B64756E2164756E21
3204
+ //# debugId=72FB605118CF0EEA64756E2164756E21
@@ -15,12 +15,12 @@ import {
15
15
  snapshotProjectVersion,
16
16
  verifyProjectMigrations,
17
17
  wizardProjectMigrations
18
- } from "./cli-prc42zqd.js";
19
- import"./cli-gcbre1zs.js";
18
+ } from "./cli-2mt6bvcj.js";
19
+ import"./cli-hb9vpsev.js";
20
20
  import"./cli-bq2v559b.js";
21
- import"./cli-sj5mtyzj.js";
22
- import"./cli-x0h03qqe.js";
23
- import"./cli-pd5pqgre.js";
21
+ import"./cli-qr2ek735.js";
22
+ import"./cli-btbpt84c.js";
23
+ import"./cli-6bhfzq5e.js";
24
24
  import"./cli-xnn9xjcy.js";
25
25
  export {
26
26
  wizardProjectMigrations,