wp-typia 0.22.2 → 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.
@@ -18,7 +18,7 @@ import {
18
18
  package_default,
19
19
  prefersStructuredCliOutput,
20
20
  resolveCommandOptionValues
21
- } from "./cli-n6hgvysz.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
@@ -71,6 +74,62 @@ function resolveBundledModuleHref(baseUrl, candidates, options = {}) {
71
74
  `));
72
75
  }
73
76
 
77
+ // src/cli-string-flags.ts
78
+ function readOptionalCliStringFlagValue(flags, name, mode) {
79
+ const value = flags[name];
80
+ if (value === undefined || value === null) {
81
+ return;
82
+ }
83
+ if (typeof value !== "string") {
84
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
85
+ }
86
+ const trimmed = value.trim();
87
+ if (trimmed.length === 0) {
88
+ if (mode === "strict") {
89
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
90
+ }
91
+ return;
92
+ }
93
+ return mode === "strict" ? value : trimmed;
94
+ }
95
+ function readOptionalLooseStringFlag(flags, name) {
96
+ return readOptionalCliStringFlagValue(flags, name, "loose");
97
+ }
98
+ function readOptionalStrictStringFlag(flags, name) {
99
+ return readOptionalCliStringFlagValue(flags, name, "strict");
100
+ }
101
+ function requireStrictStringFlag(flags, name, message) {
102
+ const value = readOptionalStrictStringFlag(flags, name);
103
+ if (!value) {
104
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
105
+ }
106
+ return value;
107
+ }
108
+ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message) {
109
+ const leftValue = readOptionalStrictStringFlag(flags, leftName);
110
+ const rightValue = readOptionalStrictStringFlag(flags, rightName);
111
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
112
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
113
+ }
114
+ return [leftValue, rightValue];
115
+ }
116
+
117
+ // src/external-layer-prompt-options.ts
118
+ function formatExternalLayerSelectHint(option2) {
119
+ const details = [
120
+ option2.description,
121
+ option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
122
+ ].filter((value) => typeof value === "string" && value.length > 0);
123
+ return details.length > 0 ? details.join(" \xB7 ") : undefined;
124
+ }
125
+ function toExternalLayerPromptOptions(options) {
126
+ return options.map((option2) => ({
127
+ hint: formatExternalLayerSelectHint(option2),
128
+ label: option2.id,
129
+ value: option2.id
130
+ }));
131
+ }
132
+
74
133
  // src/add-kind-registry.ts
75
134
  var BLOCK_VISIBLE_FIELD_ORDER = [
76
135
  "kind",
@@ -129,51 +188,12 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
129
188
  "name",
130
189
  "namespace"
131
190
  ];
132
- function readOptionalStringFlag(flags, name) {
133
- const value = flags[name];
134
- if (value === undefined || value === null) {
135
- return;
136
- }
137
- if (typeof value !== "string" || value.trim().length === 0) {
138
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
139
- }
140
- return value;
141
- }
142
- function requireStringFlag(flags, name, message) {
143
- const value = readOptionalStringFlag(flags, name);
144
- if (!value) {
145
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
146
- }
147
- return value;
148
- }
149
- function readOptionalPairedStringFlags(flags, leftName, rightName, message) {
150
- const leftValue = readOptionalStringFlag(flags, leftName);
151
- const rightValue = readOptionalStringFlag(flags, rightName);
152
- if (Boolean(leftValue) !== Boolean(rightValue)) {
153
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
154
- }
155
- return [leftValue, rightValue];
156
- }
157
191
  function requireAddKindName(context, message) {
158
192
  if (!context.name) {
159
193
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
160
194
  }
161
195
  return context.name;
162
196
  }
163
- function formatExternalLayerSelectHint(option2) {
164
- const details = [
165
- option2.description,
166
- option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
167
- ].filter((value) => typeof value === "string" && value.length > 0);
168
- return details.length > 0 ? details.join(" \xB7 ") : undefined;
169
- }
170
- function toExternalLayerPromptOptions(options) {
171
- return options.map((option2) => ({
172
- hint: formatExternalLayerSelectHint(option2),
173
- label: option2.id,
174
- value: option2.id
175
- }));
176
- }
177
197
  function defineAddKindRegistryEntry(entry) {
178
198
  return entry;
179
199
  }
@@ -189,6 +209,18 @@ function createNamedExecutionPlan(context, options) {
189
209
  function isAddPersistenceTemplate(template) {
190
210
  return template === "persistence" || template === "compound";
191
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
+ }
192
224
  var ADD_KIND_REGISTRY = {
193
225
  "admin-view": defineAddKindRegistryEntry({
194
226
  completion: {
@@ -207,7 +239,7 @@ var ADD_KIND_REGISTRY = {
207
239
  nameLabel: "Admin view name",
208
240
  async prepareExecution(context) {
209
241
  const name = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
210
- const source = readOptionalStringFlag(context.flags, "source");
242
+ const source = readOptionalStrictStringFlag(context.flags, "source");
211
243
  return createNamedExecutionPlan(context, {
212
244
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
213
245
  adminViewName: name2,
@@ -247,7 +279,7 @@ var ADD_KIND_REGISTRY = {
247
279
  nameLabel: "Binding source name",
248
280
  async prepareExecution(context) {
249
281
  const name = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
250
- const [blockName, attributeName] = readOptionalPairedStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
282
+ const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
251
283
  return createNamedExecutionPlan(context, {
252
284
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
253
285
  attributeName,
@@ -287,15 +319,16 @@ var ADD_KIND_REGISTRY = {
287
319
  nameLabel: "Block name",
288
320
  async prepareExecution(context) {
289
321
  const name = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
290
- const externalLayerId = readOptionalStringFlag(context.flags, "external-layer-id");
291
- const externalLayerSource = readOptionalStringFlag(context.flags, "external-layer-source");
322
+ const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
323
+ const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
292
324
  const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
293
325
  const selectPrompt = shouldPromptForLayerSelection ? await context.getOrCreatePrompt() : undefined;
294
- const alternateRenderTargets = readOptionalStringFlag(context.flags, "alternate-render-targets");
295
- const dataStorageMode = readOptionalStringFlag(context.flags, "data-storage");
296
- const innerBlocksPreset = readOptionalStringFlag(context.flags, "inner-blocks-preset");
297
- const persistencePolicy = readOptionalStringFlag(context.flags, "persistence-policy");
298
- let resolvedTemplateId = readOptionalStringFlag(context.flags, "template");
326
+ const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
327
+ const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
328
+ const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
329
+ const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
330
+ const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
331
+ let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
299
332
  if (!resolvedTemplateId && context.isInteractiveSession) {
300
333
  const templatePrompt = await context.getOrCreatePrompt();
301
334
  resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
@@ -392,7 +425,7 @@ var ADD_KIND_REGISTRY = {
392
425
  nameLabel: "Editor plugin name",
393
426
  async prepareExecution(context) {
394
427
  const name = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
395
- const slot = readOptionalStringFlag(context.flags, "slot");
428
+ const slot = readOptionalStrictStringFlag(context.flags, "slot");
396
429
  return createNamedExecutionPlan(context, {
397
430
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
398
431
  cwd,
@@ -430,8 +463,8 @@ var ADD_KIND_REGISTRY = {
430
463
  nameLabel: "Target block",
431
464
  async prepareExecution(context) {
432
465
  const name = requireAddKindName(context, "`wp-typia add hooked-block` requires <block-slug>. Usage: wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild>.");
433
- const anchorBlockName = requireStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
434
- const position = requireStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
466
+ const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
467
+ const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
435
468
  return createNamedExecutionPlan(context, {
436
469
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddHookedBlockCommand({
437
470
  anchorBlockName,
@@ -501,7 +534,7 @@ var ADD_KIND_REGISTRY = {
501
534
  nameLabel: "Style name",
502
535
  async prepareExecution(context) {
503
536
  const name = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
504
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
537
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
505
538
  return createNamedExecutionPlan(context, {
506
539
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
507
540
  blockName: blockSlug,
@@ -539,8 +572,8 @@ var ADD_KIND_REGISTRY = {
539
572
  nameLabel: "Transform name",
540
573
  async prepareExecution(context) {
541
574
  const name = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
542
- const fromBlockName = requireStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
543
- const toBlockName = requireStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
575
+ const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
576
+ const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
544
577
  return createNamedExecutionPlan(context, {
545
578
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockTransformCommand({
546
579
  cwd,
@@ -581,8 +614,8 @@ var ADD_KIND_REGISTRY = {
581
614
  nameLabel: "REST resource name",
582
615
  async prepareExecution(context) {
583
616
  const name = requireAddKindName(context, "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].");
584
- const methods = readOptionalStringFlag(context.flags, "methods");
585
- const namespace = readOptionalStringFlag(context.flags, "namespace");
617
+ const methods = readOptionalStrictStringFlag(context.flags, "methods");
618
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
586
619
  return createNamedExecutionPlan(context, {
587
620
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
588
621
  cwd,
@@ -621,7 +654,7 @@ var ADD_KIND_REGISTRY = {
621
654
  nameLabel: "AI feature name",
622
655
  async prepareExecution(context) {
623
656
  const name = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
624
- const namespace = readOptionalStringFlag(context.flags, "namespace");
657
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
625
658
  return createNamedExecutionPlan(context, {
626
659
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
627
660
  aiFeatureName: name2,
@@ -660,7 +693,7 @@ var ADD_KIND_REGISTRY = {
660
693
  nameLabel: "Variation name",
661
694
  async prepareExecution(context) {
662
695
  const name = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
663
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
696
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
664
697
  return createNamedExecutionPlan(context, {
665
698
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
666
699
  blockName: blockSlug,
@@ -811,7 +844,7 @@ async function simulateWorkspaceAddDryRun({
811
844
  cwd,
812
845
  execute
813
846
  }) {
814
- const { resolveWorkspaceProject } = await import("./workspace-project-gxb499cp.js");
847
+ const { resolveWorkspaceProject } = await import("./workspace-project-7826tewa.js");
815
848
  const workspace = resolveWorkspaceProject(cwd);
816
849
  const relativeCwd = path.relative(workspace.projectDir, path.resolve(cwd));
817
850
  const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-add-plan-");
@@ -831,10 +864,6 @@ async function simulateWorkspaceAddDryRun({
831
864
  }
832
865
  }
833
866
 
834
- // src/runtime-bridge-output.ts
835
- import fs3 from "fs";
836
- import path2 from "path";
837
-
838
867
  // src/output-markers.ts
839
868
  var UNICODE_OUTPUT_MARKERS = {
840
869
  dryRun: "\uD83E\uDDEA",
@@ -1080,32 +1109,6 @@ function buildInitCompletionPayload(plan, markerOptions) {
1080
1109
  warningLines: plan.notes
1081
1110
  };
1082
1111
  }
1083
- function inferProjectPackageManager(projectDir) {
1084
- try {
1085
- const packageJsonPath = path2.join(projectDir, "package.json");
1086
- if (fs3.existsSync(packageJsonPath)) {
1087
- const manifest = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
1088
- if (manifest.packageManager?.startsWith("bun@"))
1089
- return "bun";
1090
- if (manifest.packageManager?.startsWith("pnpm@"))
1091
- return "pnpm";
1092
- if (manifest.packageManager?.startsWith("yarn@"))
1093
- return "yarn";
1094
- if (manifest.packageManager?.startsWith("npm@"))
1095
- return "npm";
1096
- }
1097
- } catch {}
1098
- if (fs3.existsSync(path2.join(projectDir, "bun.lock")) || fs3.existsSync(path2.join(projectDir, "bun.lockb"))) {
1099
- return "bun";
1100
- }
1101
- if (fs3.existsSync(path2.join(projectDir, "pnpm-lock.yaml"))) {
1102
- return "pnpm";
1103
- }
1104
- if (fs3.existsSync(path2.join(projectDir, "yarn.lock")) || fs3.existsSync(path2.join(projectDir, ".yarnrc.yml"))) {
1105
- return "yarn";
1106
- }
1107
- return "npm";
1108
- }
1109
1112
  function buildMigrationCompletionPayload(options, markerOptions) {
1110
1113
  const summaryLines = options.lines.filter((line) => line.trim().length > 0);
1111
1114
  return {
@@ -1115,7 +1118,7 @@ function buildMigrationCompletionPayload(options, markerOptions) {
1115
1118
  }
1116
1119
  function buildAddCompletionPayload(options, markerOptions) {
1117
1120
  const verificationLines = [
1118
- 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")
1119
1122
  ];
1120
1123
  const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
1121
1124
  const completion = buildAddKindCompletionDetails(options.kind, {
@@ -1165,20 +1168,6 @@ function printBlock(lines, printLine) {
1165
1168
  printLine(line);
1166
1169
  }
1167
1170
  }
1168
- function formatExternalLayerSelectHint2(option2) {
1169
- const details = [
1170
- option2.description,
1171
- option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
1172
- ].filter((value) => typeof value === "string" && value.length > 0);
1173
- return details.length > 0 ? details.join(" \xB7 ") : undefined;
1174
- }
1175
- function toExternalLayerPromptOptions2(options) {
1176
- return options.map((option2) => ({
1177
- hint: formatExternalLayerSelectHint2(option2),
1178
- label: option2.id,
1179
- value: option2.id
1180
- }));
1181
- }
1182
1171
 
1183
1172
  // src/runtime-capabilities.ts
1184
1173
  function isInteractiveTerminal({
@@ -1194,8 +1183,8 @@ function supportsInteractiveTui(options = {}) {
1194
1183
  }
1195
1184
  // src/runtime-bridge-sync.ts
1196
1185
  import { spawnSync } from "child_process";
1197
- import fs4 from "fs";
1198
- import path3 from "path";
1186
+ import fs3 from "fs";
1187
+ import path2 from "path";
1199
1188
  var SYNC_INSTALL_MARKERS = [
1200
1189
  "node_modules",
1201
1190
  ".pnp.cjs",
@@ -1212,64 +1201,15 @@ function resolveSyncExecutionTarget(subcommand) {
1212
1201
  }
1213
1202
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
1214
1203
  }
1215
- function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
1216
- const args = extraArgs.trim();
1217
- if (packageManagerId === "bun") {
1218
- return args ? `bun run ${scriptName} ${args}` : `bun run ${scriptName}`;
1219
- }
1220
- if (packageManagerId === "npm") {
1221
- return args ? `npm run ${scriptName} -- ${args}` : `npm run ${scriptName}`;
1222
- }
1223
- if (packageManagerId === "pnpm") {
1224
- return args ? `pnpm run ${scriptName} ${args}` : `pnpm run ${scriptName}`;
1225
- }
1226
- return args ? `yarn run ${scriptName} ${args}` : `yarn run ${scriptName}`;
1227
- }
1228
- function formatInstallCommand(packageManagerId) {
1229
- switch (packageManagerId) {
1230
- case "bun":
1231
- return "bun install";
1232
- case "pnpm":
1233
- return "pnpm install";
1234
- case "yarn":
1235
- return "yarn install";
1236
- default:
1237
- return "npm install";
1238
- }
1239
- }
1240
1204
  function getSyncRootError(cwd) {
1241
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.`);
1242
1206
  }
1243
- function inferSyncPackageManager(cwd, packageManagerField) {
1244
- const field = String(packageManagerField ?? "");
1245
- if (field.startsWith("bun@"))
1246
- return "bun";
1247
- if (field.startsWith("npm@"))
1248
- return "npm";
1249
- if (field.startsWith("pnpm@"))
1250
- return "pnpm";
1251
- if (field.startsWith("yarn@"))
1252
- return "yarn";
1253
- if (fs4.existsSync(path3.join(cwd, "bun.lock")) || fs4.existsSync(path3.join(cwd, "bun.lockb"))) {
1254
- return "bun";
1255
- }
1256
- if (fs4.existsSync(path3.join(cwd, "pnpm-lock.yaml"))) {
1257
- return "pnpm";
1258
- }
1259
- 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"))) {
1260
- return "yarn";
1261
- }
1262
- if (fs4.existsSync(path3.join(cwd, "package-lock.json")) || fs4.existsSync(path3.join(cwd, "npm-shrinkwrap.json"))) {
1263
- return "npm";
1264
- }
1265
- return "npm";
1266
- }
1267
1207
  function resolveSyncProjectContext(cwd) {
1268
- const packageJsonPath = path3.join(cwd, "package.json");
1269
- if (!fs4.existsSync(packageJsonPath)) {
1208
+ const packageJsonPath = path2.join(cwd, "package.json");
1209
+ if (!fs3.existsSync(packageJsonPath)) {
1270
1210
  throw getSyncRootError(cwd);
1271
1211
  }
1272
- const packageJson = JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
1212
+ const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
1273
1213
  const scripts = packageJson.scripts ?? {};
1274
1214
  const syncScripts = {
1275
1215
  sync: typeof scripts.sync === "string" ? {
@@ -1295,17 +1235,17 @@ function resolveSyncProjectContext(cwd) {
1295
1235
  return {
1296
1236
  cwd,
1297
1237
  packageJsonPath,
1298
- packageManager: inferSyncPackageManager(cwd, packageJson.packageManager),
1238
+ packageManager: inferPackageManagerId(cwd, packageJson.packageManager),
1299
1239
  scripts: syncScripts
1300
1240
  };
1301
1241
  }
1302
1242
  function findInstalledDependencyMarkerDir(projectDir) {
1303
- let currentDir = path3.resolve(projectDir);
1243
+ let currentDir = path2.resolve(projectDir);
1304
1244
  while (true) {
1305
- 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)))) {
1306
1246
  return currentDir;
1307
1247
  }
1308
- const parentDir = path3.dirname(currentDir);
1248
+ const parentDir = path2.dirname(currentDir);
1309
1249
  if (parentDir === currentDir) {
1310
1250
  return null;
1311
1251
  }
@@ -1440,14 +1380,14 @@ async function executeSyncCommand({
1440
1380
  }
1441
1381
 
1442
1382
  // src/runtime-bridge.ts
1443
- var loadCliAddRuntime = () => import("./cli-add-s0p4w1wz.js");
1383
+ var loadCliAddRuntime = () => import("./cli-add-6s6kzf7x.js");
1444
1384
  var loadCliDiagnosticsRuntime = () => import("./cli-diagnostics-5dvztm7q.js");
1445
- var loadCliDoctorRuntime = () => import("./cli-doctor-6dchxz12.js");
1446
- var loadCliInitRuntime = () => import("./cli-init-r6h1xchq.js");
1385
+ var loadCliDoctorRuntime = () => import("./cli-doctor-70zd5m3b.js");
1386
+ var loadCliInitRuntime = () => import("./cli-init-kjjyky1y.js");
1447
1387
  var loadCliPromptRuntime = () => import("./cli-prompt-614tq57c.js");
1448
- var loadCliScaffoldRuntime = () => import("./cli-scaffold-f023yxc5.js");
1388
+ var loadCliScaffoldRuntime = () => import("./cli-scaffold-f57ccf5v.js");
1449
1389
  var loadCliTemplatesRuntime = () => import("./cli-templates-9t2a7zqd.js");
1450
- var loadMigrationsRuntime = () => import("./migrations-pg5b9fh4.js");
1390
+ var loadMigrationsRuntime = () => import("./migrations-vw502qf9.js");
1451
1391
  async function wrapCliCommandError(command, error) {
1452
1392
  const { createCliCommandError } = await loadCliDiagnosticsRuntime();
1453
1393
  return createCliCommandError({ command, error });
@@ -1461,17 +1401,6 @@ function shouldWrapCliCommandError(options) {
1461
1401
  }
1462
1402
  return true;
1463
1403
  }
1464
- function readOptionalLooseStringFlag(flags, name) {
1465
- const value = flags[name];
1466
- if (value === undefined || value === null) {
1467
- return;
1468
- }
1469
- if (typeof value !== "string") {
1470
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
1471
- }
1472
- const trimmed = value.trim();
1473
- return trimmed.length > 0 ? trimmed : undefined;
1474
- }
1475
1404
  function pushFlag(argv, name, value) {
1476
1405
  if (value === undefined || value === null || value === false) {
1477
1406
  return;
@@ -1613,7 +1542,7 @@ async function executeCreateCommand({
1613
1542
  promptText: activePrompt ? (message, defaultValue, validate) => activePrompt.text(message, defaultValue, validate) : undefined,
1614
1543
  queryPostType: readOptionalLooseStringFlag(flags, "query-post-type"),
1615
1544
  selectDataStorage: activePrompt ? () => activePrompt.select("Select a data storage mode", [...DATA_STORAGE_PROMPT_OPTIONS], 1) : undefined,
1616
- selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions2(options), 1) : undefined,
1545
+ selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
1617
1546
  selectPackageManager: activePrompt ? () => activePrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
1618
1547
  selectPersistencePolicy: activePrompt ? () => activePrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
1619
1548
  selectTemplate: activePrompt ? () => activePrompt.select("Select a template", getTemplateSelectOptions(), 1) : undefined,
@@ -2406,7 +2335,7 @@ var doctorCommand = defineCommand({
2406
2335
  const prefersStructuredOutput = prefersStructuredCliOutput(args);
2407
2336
  if (prefersStructuredOutput) {
2408
2337
  const [{ getDoctorChecks }, { getDoctorFailureDetailLines }] = await Promise.all([
2409
- import("./cli-doctor-6dchxz12.js"),
2338
+ import("./cli-doctor-70zd5m3b.js"),
2410
2339
  import("./cli-diagnostics-5dvztm7q.js")
2411
2340
  ]);
2412
2341
  const checks = await getDoctorChecks(args.cwd);
@@ -2464,8 +2393,8 @@ var initCommand = defineCommand({
2464
2393
  });
2465
2394
 
2466
2395
  // src/mcp.ts
2467
- import fs5 from "fs/promises";
2468
- import path4 from "path";
2396
+ import fs4 from "fs/promises";
2397
+ import path3 from "path";
2469
2398
 
2470
2399
  // ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
2471
2400
  class SchemaConversionError extends TaggedError("SchemaConversionError")() {
@@ -2484,7 +2413,7 @@ class McpToolsProviderError extends TaggedError("McpToolsProviderError")() {
2484
2413
  function jsonSchemaToZodSchema(schema, options = {}) {
2485
2414
  return convertSchema(schema, options, "$");
2486
2415
  }
2487
- function convertSchema(schema, options, path4) {
2416
+ function convertSchema(schema, options, path3) {
2488
2417
  const { coerce = true } = options;
2489
2418
  if (!schema || typeof schema !== "object") {
2490
2419
  return Result.ok(exports_external.unknown());
@@ -2499,49 +2428,49 @@ function convertSchema(schema, options, path4) {
2499
2428
  return Result.ok(exports_external.enum(enumValues));
2500
2429
  }
2501
2430
  const literals = enumValues.map((v) => exports_external.literal(v));
2502
- return unionFromSchemas(literals, path4);
2431
+ return unionFromSchemas(literals, path3);
2503
2432
  }
2504
2433
  }
2505
2434
  if (schema.anyOf && schema.anyOf.length > 0) {
2506
- const schemas = mapSchemas(schema.anyOf, options, `${path4}.anyOf`);
2435
+ const schemas = mapSchemas(schema.anyOf, options, `${path3}.anyOf`);
2507
2436
  if (Result.isError(schemas)) {
2508
2437
  return schemas;
2509
2438
  }
2510
- return unionFromSchemas(schemas.value, `${path4}.anyOf`);
2439
+ return unionFromSchemas(schemas.value, `${path3}.anyOf`);
2511
2440
  }
2512
2441
  if (schema.oneOf && schema.oneOf.length > 0) {
2513
- const schemas = mapSchemas(schema.oneOf, options, `${path4}.oneOf`);
2442
+ const schemas = mapSchemas(schema.oneOf, options, `${path3}.oneOf`);
2514
2443
  if (Result.isError(schemas)) {
2515
2444
  return schemas;
2516
2445
  }
2517
- return unionFromSchemas(schemas.value, `${path4}.oneOf`);
2446
+ return unionFromSchemas(schemas.value, `${path3}.oneOf`);
2518
2447
  }
2519
2448
  const schemaType = Array.isArray(schema.type) ? schema.type[0] : schema.type;
2520
2449
  switch (schemaType) {
2521
2450
  case "string":
2522
- return buildStringSchema(schema, path4);
2451
+ return buildStringSchema(schema, path3);
2523
2452
  case "number":
2524
2453
  case "integer":
2525
2454
  return Result.ok(buildNumberSchema(schema, coerce));
2526
2455
  case "boolean":
2527
2456
  return Result.ok(buildBooleanSchema());
2528
2457
  case "array":
2529
- return buildArraySchema(schema, options, path4);
2458
+ return buildArraySchema(schema, options, path3);
2530
2459
  case "object":
2531
- return buildObjectSchema(schema, options, path4);
2460
+ return buildObjectSchema(schema, options, path3);
2532
2461
  case "null":
2533
2462
  return Result.ok(exports_external.null());
2534
2463
  default:
2535
2464
  if (schema.properties) {
2536
- return buildObjectSchema(schema, options, path4);
2465
+ return buildObjectSchema(schema, options, path3);
2537
2466
  }
2538
2467
  if (schema.items) {
2539
- return buildArraySchema(schema, options, path4);
2468
+ return buildArraySchema(schema, options, path3);
2540
2469
  }
2541
2470
  return Result.ok(exports_external.unknown());
2542
2471
  }
2543
2472
  }
2544
- function buildStringSchema(schema, path4) {
2473
+ function buildStringSchema(schema, path3) {
2545
2474
  let zodSchema = exports_external.string();
2546
2475
  if (schema.minLength !== undefined) {
2547
2476
  zodSchema = zodSchema.min(schema.minLength);
@@ -2554,7 +2483,7 @@ function buildStringSchema(schema, path4) {
2554
2483
  const regexResult = Result.try({
2555
2484
  try: () => new RegExp(pattern),
2556
2485
  catch: (cause) => new SchemaConversionError({
2557
- path: path4,
2486
+ path: path3,
2558
2487
  message: `Invalid regex pattern "${pattern}"`,
2559
2488
  cause
2560
2489
  })
@@ -2611,19 +2540,19 @@ function buildNumberSchema(schema, coerce) {
2611
2540
  function buildBooleanSchema() {
2612
2541
  return exports_external.boolean();
2613
2542
  }
2614
- function buildArraySchema(schema, options, path4) {
2543
+ function buildArraySchema(schema, options, path3) {
2615
2544
  let itemSchema = exports_external.unknown();
2616
2545
  if (schema.items) {
2617
2546
  if (Array.isArray(schema.items)) {
2618
2547
  if (schema.items.length > 0) {
2619
- const itemResult = convertSchema(schema.items[0], options, `${path4}.items[0]`);
2548
+ const itemResult = convertSchema(schema.items[0], options, `${path3}.items[0]`);
2620
2549
  if (Result.isError(itemResult)) {
2621
2550
  return itemResult;
2622
2551
  }
2623
2552
  itemSchema = itemResult.value;
2624
2553
  }
2625
2554
  } else {
2626
- const itemResult = convertSchema(schema.items, options, `${path4}.items`);
2555
+ const itemResult = convertSchema(schema.items, options, `${path3}.items`);
2627
2556
  if (Result.isError(itemResult)) {
2628
2557
  return itemResult;
2629
2558
  }
@@ -2639,14 +2568,14 @@ function buildArraySchema(schema, options, path4) {
2639
2568
  }
2640
2569
  return Result.ok(zodSchema);
2641
2570
  }
2642
- function buildObjectSchema(schema, options, path4) {
2571
+ function buildObjectSchema(schema, options, path3) {
2643
2572
  if (!schema.properties) {
2644
2573
  return Result.ok(exports_external.record(exports_external.string(), exports_external.unknown()));
2645
2574
  }
2646
2575
  const shape = {};
2647
2576
  const requiredFields = new Set(schema.required || []);
2648
2577
  for (const [propName, propSchema] of Object.entries(schema.properties)) {
2649
- const propResult = convertSchema(propSchema, options, `${path4}.properties.${propName}`);
2578
+ const propResult = convertSchema(propSchema, options, `${path3}.properties.${propName}`);
2650
2579
  if (Result.isError(propResult)) {
2651
2580
  return propResult;
2652
2581
  }
@@ -2661,10 +2590,10 @@ function buildObjectSchema(schema, options, path4) {
2661
2590
  }
2662
2591
  return Result.ok(exports_external.object(shape));
2663
2592
  }
2664
- function mapSchemas(schemas, options, path4) {
2593
+ function mapSchemas(schemas, options, path3) {
2665
2594
  const zodSchemas = [];
2666
2595
  for (let index = 0;index < schemas.length; index += 1) {
2667
- const converted = convertSchema(schemas[index], options, `${path4}[${index}]`);
2596
+ const converted = convertSchema(schemas[index], options, `${path3}[${index}]`);
2668
2597
  if (Result.isError(converted)) {
2669
2598
  return converted;
2670
2599
  }
@@ -2672,11 +2601,11 @@ function mapSchemas(schemas, options, path4) {
2672
2601
  }
2673
2602
  return Result.ok(zodSchemas);
2674
2603
  }
2675
- function unionFromSchemas(schemas, path4) {
2604
+ function unionFromSchemas(schemas, path3) {
2676
2605
  if (schemas.length === 0) {
2677
2606
  return Result.err(new SchemaConversionError({
2678
- path: path4,
2679
- 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}`,
2680
2609
  cause: new Error("Empty schema union")
2681
2610
  }));
2682
2611
  }
@@ -2993,8 +2922,8 @@ function isToolGroup(value) {
2993
2922
  return isObject(value) && typeof value.namespace === "string" && Array.isArray(value.tools) && value.tools.every(isTool);
2994
2923
  }
2995
2924
  async function readSchemaSource(cwd, source) {
2996
- const schemaPath = path4.resolve(cwd, source.path);
2997
- const raw = await fs5.readFile(schemaPath, "utf8");
2925
+ const schemaPath = path3.resolve(cwd, source.path);
2926
+ const raw = await fs4.readFile(schemaPath, "utf8");
2998
2927
  const parsed = JSON.parse(raw);
2999
2928
  if (isToolGroup(parsed)) {
3000
2929
  return parsed;
@@ -3010,7 +2939,7 @@ async function readSchemaSource(cwd, source) {
3010
2939
  async function loadMcpToolGroups(cwd, schemaSources) {
3011
2940
  return Promise.all(schemaSources.map((source) => readSchemaSource(cwd, source)));
3012
2941
  }
3013
- async function syncMcpSchemas(cwd, schemaSources, outputDir = path4.join(cwd, ".bunli", "mcp")) {
2942
+ async function syncMcpSchemas(cwd, schemaSources, outputDir = path3.join(cwd, ".bunli", "mcp")) {
3014
2943
  const groups = await loadMcpToolGroups(cwd, schemaSources);
3015
2944
  const result = await generateMCPTypes({
3016
2945
  outputDir,
@@ -3032,8 +2961,8 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path4.join(cwd, ".
3032
2961
  throw convert.error;
3033
2962
  }
3034
2963
  }
3035
- await fs5.mkdir(outputDir, { recursive: true });
3036
- 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)}
3037
2966
  `, "utf8");
3038
2967
  return {
3039
2968
  commandCount: registry.reduce((count, group) => count + group.tools.length, 0),
@@ -3272,4 +3201,4 @@ export {
3272
3201
  wpTypiaCommands
3273
3202
  };
3274
3203
 
3275
- //# debugId=844373B8B205795464756E2164756E21
3204
+ //# debugId=72FB605118CF0EEA64756E2164756E21