wp-typia 0.24.7 → 0.24.9

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/dist/cli.js +82 -18
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -15,6 +15,12 @@ The published package executes through the Node-first CLI runtime. `bunx` is a
15
15
  supported package-runner invocation, not a requirement for npm-installed
16
16
  commands.
17
17
 
18
+ Generated scaffolds target WordPress 7.0 for `Tested up to` plugin headers by
19
+ default. Pass `--wp-version 6.9` to restore the legacy 6.9 scaffold target; the
20
+ `Requires at least` header remains tied to the selected feature hard floor. Use
21
+ `wp-typia doctor --wp-version-check` to validate workspace headers against
22
+ generated block, ability, and AI feature metadata.
23
+
18
24
  Extend an existing workspace with:
19
25
 
20
26
  - `wp-typia add block counter-card --template basic`
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "wp-typia",
24
- version: "0.24.7",
24
+ version: "0.24.9",
25
25
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
26
26
  packageManager: "bun@1.3.11",
27
27
  type: "module",
@@ -77,7 +77,7 @@ var init_package = __esm(() => {
77
77
  dependencies: {
78
78
  "@gunshi/plugin-completion": "0.32.0",
79
79
  "@wp-typia/api-client": "^0.4.6",
80
- "@wp-typia/project-tools": "0.24.6",
80
+ "@wp-typia/project-tools": "0.24.7",
81
81
  gunshi: "0.32.0",
82
82
  zod: "4.3.6"
83
83
  },
@@ -1287,7 +1287,8 @@ var init_pattern = __esm(() => {
1287
1287
  const catalogTitle = rawCatalogTitle;
1288
1288
  const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
1289
1289
  const thumbnailUrl = rawThumbnailUrl;
1290
- if (context.flags.tag !== undefined && context.flags.format !== "json") {
1290
+ const legacyTagWarning = context.flags.tag !== undefined ? LEGACY_TAG_FLAG_WARNING : undefined;
1291
+ if (legacyTagWarning && context.flags.format !== "json") {
1291
1292
  context.warnLine(LEGACY_TAG_FLAG_WARNING);
1292
1293
  }
1293
1294
  return {
@@ -1313,6 +1314,7 @@ var init_pattern = __esm(() => {
1313
1314
  patternScope: result.patternScope,
1314
1315
  ...result.sectionRole ? { sectionRole: result.sectionRole } : {}
1315
1316
  }),
1317
+ getWarnings: () => context.flags.format === "json" && legacyTagWarning ? [legacyTagWarning] : undefined,
1316
1318
  warnLine: context.warnLine
1317
1319
  };
1318
1320
  },
@@ -2446,6 +2448,7 @@ function isInteractiveTerminal({
2446
2448
  }
2447
2449
 
2448
2450
  // src/runtime-bridge-add.ts
2451
+ import { HOOKED_BLOCK_POSITION_IDS } from "@wp-typia/project-tools/hooked-blocks";
2449
2452
  import {
2450
2453
  CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES16,
2451
2454
  createCliDiagnosticCodeError as createCliDiagnosticCodeError12
@@ -2498,6 +2501,29 @@ async function executePlannedAddKind(kind, executionContext, context) {
2498
2501
  function contextAllowsInteractivePrompts(flags) {
2499
2502
  return flags.format !== "json";
2500
2503
  }
2504
+ function shouldPromptForRequiredAddField(flags, fieldName) {
2505
+ const value = flags[fieldName];
2506
+ return value === undefined || value === null || typeof value === "string" && value.trim().length === 0;
2507
+ }
2508
+ async function promptForRequiredAddFields(options) {
2509
+ const requiredFields = REQUIRED_FIELD_PROMPTS_BY_ADD_KIND[options.kind] ?? [];
2510
+ for (const fieldName of requiredFields) {
2511
+ if (!shouldPromptForRequiredAddField(options.flags, fieldName)) {
2512
+ continue;
2513
+ }
2514
+ const label = REQUIRED_FIELD_PROMPT_LABELS[fieldName];
2515
+ const fieldPrompt = await options.getOrCreatePrompt();
2516
+ if (fieldName === "position") {
2517
+ options.flags[fieldName] = await fieldPrompt.select(label, HOOKED_BLOCK_POSITION_IDS.map((position) => ({
2518
+ hint: `Insert relative to the anchor block as ${position}`,
2519
+ label: position,
2520
+ value: position
2521
+ })), 2);
2522
+ continue;
2523
+ }
2524
+ options.flags[fieldName] = await fieldPrompt.text(label, "", (value) => value.trim().length > 0 ? true : `${label} is required.`);
2525
+ }
2526
+ }
2501
2527
  async function executeAddCommand({
2502
2528
  cwd,
2503
2529
  emitOutput = true,
@@ -2511,7 +2537,8 @@ async function executeAddCommand({
2511
2537
  warnLine = console.warn
2512
2538
  }) {
2513
2539
  let activePrompt;
2514
- const dryRun = Boolean(flags["dry-run"]);
2540
+ const resolvedFlags = { ...flags };
2541
+ const dryRun = Boolean(resolvedFlags["dry-run"]);
2515
2542
  try {
2516
2543
  const addRuntime = await loadCliAddRuntime();
2517
2544
  const isInteractiveSession = interactive ?? isInteractiveTerminal();
@@ -2525,15 +2552,13 @@ async function executeAddCommand({
2525
2552
  };
2526
2553
  let resolvedKind = kind;
2527
2554
  let resolvedName = name;
2528
- let promptedForKind = false;
2529
- if (!resolvedKind && isInteractiveSession && contextAllowsInteractivePrompts(flags)) {
2555
+ if (!resolvedKind && isInteractiveSession && contextAllowsInteractivePrompts(resolvedFlags)) {
2530
2556
  const kindPrompt = await getOrCreatePrompt();
2531
2557
  resolvedKind = await kindPrompt.select("Select what to add", getAddKindOptions().map((option) => ({
2532
2558
  hint: option.description,
2533
2559
  label: option.name,
2534
2560
  value: option.value
2535
2561
  })), 1);
2536
- promptedForKind = true;
2537
2562
  }
2538
2563
  if (!resolvedKind) {
2539
2564
  if (shouldPrintMissingAddKindHelp({ emitOutput })) {
@@ -2544,17 +2569,24 @@ async function executeAddCommand({
2544
2569
  if (!isAddKindId(resolvedKind)) {
2545
2570
  throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES16.INVALID_COMMAND, `Unknown add kind "${resolvedKind}". Expected one of: ${formatAddKindList()}.`);
2546
2571
  }
2547
- if (!resolvedName && promptedForKind) {
2572
+ if (!resolvedName && isInteractiveSession && contextAllowsInteractivePrompts(resolvedFlags)) {
2548
2573
  const namePrompt = await getOrCreatePrompt();
2549
2574
  resolvedName = await namePrompt.text(getAddNameLabel(resolvedKind), "", (value) => value.trim().length > 0 ? true : `${getAddNameLabel(resolvedKind)} is required.`);
2550
2575
  }
2576
+ if (isInteractiveSession && contextAllowsInteractivePrompts(resolvedFlags)) {
2577
+ await promptForRequiredAddFields({
2578
+ flags: resolvedFlags,
2579
+ getOrCreatePrompt,
2580
+ kind: resolvedKind
2581
+ });
2582
+ }
2551
2583
  if (dryRun && !supportsAddKindDryRun(resolvedKind)) {
2552
2584
  throw createCliDiagnosticCodeError12(CLI_DIAGNOSTIC_CODES16.INVALID_ARGUMENT, `\`wp-typia add ${resolvedKind}\` does not support \`--dry-run\` yet.`);
2553
2585
  }
2554
2586
  const executionContext = {
2555
2587
  addRuntime,
2556
2588
  cwd,
2557
- flags,
2589
+ flags: resolvedFlags,
2558
2590
  getOrCreatePrompt,
2559
2591
  isInteractiveSession,
2560
2592
  name: resolvedName,
@@ -2578,13 +2610,29 @@ async function executeAddCommand({
2578
2610
  }
2579
2611
  }
2580
2612
  }
2581
- var loadCliAddRuntime = () => import("@wp-typia/project-tools/cli-add"), loadCliPromptRuntime = () => import("@wp-typia/project-tools/cli-prompt");
2613
+ var loadCliAddRuntime = () => import("@wp-typia/project-tools/cli-add"), loadCliPromptRuntime = () => import("@wp-typia/project-tools/cli-prompt"), REQUIRED_FIELD_PROMPTS_BY_ADD_KIND, REQUIRED_FIELD_PROMPT_LABELS;
2582
2614
  var init_runtime_bridge_add = __esm(() => {
2583
2615
  init_add_kind_registry();
2584
2616
  init_cli_error_messages();
2585
2617
  init_runtime_bridge_add_dry_run();
2586
2618
  init_runtime_bridge_output();
2587
2619
  init_runtime_bridge_shared();
2620
+ REQUIRED_FIELD_PROMPTS_BY_ADD_KIND = {
2621
+ "core-variation": ["block"],
2622
+ "hooked-block": ["anchor", "position"],
2623
+ "post-meta": ["post-type"],
2624
+ style: ["block"],
2625
+ transform: ["from", "to"],
2626
+ variation: ["block"]
2627
+ };
2628
+ REQUIRED_FIELD_PROMPT_LABELS = {
2629
+ anchor: "Anchor block",
2630
+ block: "Target block",
2631
+ from: "Source block",
2632
+ position: "Hook position",
2633
+ "post-type": "Post type",
2634
+ to: "Target block"
2635
+ };
2588
2636
  });
2589
2637
 
2590
2638
  // src/runtime-bridge-create.ts
@@ -2659,6 +2707,7 @@ async function executeCreateCommand({
2659
2707
  withMigrationUi: flags["with-migration-ui"],
2660
2708
  withTestPreset: flags["with-test-preset"],
2661
2709
  withWpEnv: flags["with-wp-env"],
2710
+ wpVersion: readOptionalLooseStringFlag(flags, "wp-version"),
2662
2711
  yes: effectiveYes
2663
2712
  });
2664
2713
  const payload = flow.dryRun && flow.plan ? buildCreateDryRunPayload({
@@ -2716,7 +2765,10 @@ var init_runtime_bridge_create = __esm(() => {
2716
2765
  async function executeDoctorCommand(cwd, options = {}) {
2717
2766
  try {
2718
2767
  const { runDoctor } = await loadCliDoctorRuntime();
2719
- await runDoctor(cwd, { exitPolicy: options.exitPolicy });
2768
+ await runDoctor(cwd, {
2769
+ exitPolicy: options.exitPolicy,
2770
+ wordpressVersionCheck: options.wordpressVersionCheck
2771
+ });
2720
2772
  } catch (error) {
2721
2773
  throw await wrapCliCommandError("doctor", error);
2722
2774
  }
@@ -2906,13 +2958,13 @@ import {
2906
2958
  CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES19,
2907
2959
  createCliCommandError as createCliCommandError8
2908
2960
  } from "@wp-typia/project-tools/cli-diagnostics";
2909
- async function renderPortableCliDoctorJson(cwd, exitPolicy, printLine) {
2961
+ async function renderPortableCliDoctorJson(cwd, exitPolicy, wordpressVersionCheck, printLine) {
2910
2962
  const {
2911
2963
  createDoctorRunSummary,
2912
2964
  getDoctorChecks,
2913
2965
  getDoctorExitFailureDetailLines
2914
2966
  } = await import("@wp-typia/project-tools/cli-doctor");
2915
- const checks = await getDoctorChecks(cwd);
2967
+ const checks = await getDoctorChecks(cwd, { wordpressVersionCheck });
2916
2968
  const summary = createDoctorRunSummary(checks, { exitPolicy });
2917
2969
  printLine(JSON.stringify({
2918
2970
  checks,
@@ -2933,11 +2985,12 @@ async function dispatchPortableCliDoctor({
2933
2985
  printLine
2934
2986
  }) {
2935
2987
  const exitPolicy = mergedFlags["workspace-only"] ? "workspace-only" : "strict";
2988
+ const wordpressVersionCheck = Boolean(mergedFlags["wp-version-check"]);
2936
2989
  if (mergedFlags.format === "json") {
2937
- await renderPortableCliDoctorJson(cwd, exitPolicy, printLine);
2990
+ await renderPortableCliDoctorJson(cwd, exitPolicy, wordpressVersionCheck, printLine);
2938
2991
  return;
2939
2992
  }
2940
- await executeDoctorCommand(cwd, { exitPolicy });
2993
+ await executeDoctorCommand(cwd, { exitPolicy, wordpressVersionCheck });
2941
2994
  }
2942
2995
  var init_doctor = __esm(() => {
2943
2996
  init_runtime_bridge();
@@ -3566,6 +3619,10 @@ var CREATE_OPTION_METADATA = {
3566
3619
  description: "Include a local wp-env preset.",
3567
3620
  type: "boolean"
3568
3621
  },
3622
+ "wp-version": {
3623
+ description: "WordPress target for generated plugin headers; one of 6.9 or 7.0. Defaults to 7.0.",
3624
+ type: "string"
3625
+ },
3569
3626
  yes: {
3570
3627
  argumentKind: "flag",
3571
3628
  description: "Accept defaults without prompt fallbacks.",
@@ -3583,6 +3640,11 @@ var DOCTOR_OPTION_METADATA = {
3583
3640
  argumentKind: "flag",
3584
3641
  description: "Fail only on workspace-scoped doctor checks; environment/runtime failures remain advisory in JSON summaries.",
3585
3642
  type: "boolean"
3643
+ },
3644
+ "wp-version-check": {
3645
+ argumentKind: "flag",
3646
+ description: "Check generated WordPress feature floors against plugin bootstrap headers and the current scaffold target.",
3647
+ type: "boolean"
3586
3648
  }
3587
3649
  };
3588
3650
  // src/command-options/global.ts
@@ -4314,8 +4376,10 @@ function renderNoCommandHelp(printLine) {
4314
4376
  renderGeneralHelp(printLine);
4315
4377
  }
4316
4378
  function renderUnknownHelpTarget(printLine, target) {
4379
+ const suggestion = suggestTopLevelCommandTypo(target);
4317
4380
  printBlock(printLine, [
4318
4381
  `Unknown help target "${target}".`,
4382
+ ...suggestion ? [`Did you mean "${suggestion}"? Run wp-typia ${suggestion} --help.`] : [],
4319
4383
  `Supported commands: ${WP_TYPIA_PORTABLE_CLI_TOP_LEVEL_COMMAND_NAMES.join(", ")}.`,
4320
4384
  "Run wp-typia --help for general usage."
4321
4385
  ]);
@@ -4343,9 +4407,9 @@ var PORTABLE_CLI_COMMAND_HELP_CONFIG = {
4343
4407
  },
4344
4408
  doctor: {
4345
4409
  bodyLines: [
4346
- "Runs read-only environment readiness checks. Official wp-typia workspace roots also get inventory, source-tree drift, iframe/API v3 compatibility, and shared convention checks. Use --workspace-only for CI gates that should fail only on workspace-scoped checks while keeping environment failures advisory."
4410
+ "Runs read-only environment readiness checks. Official wp-typia workspace roots also get inventory, source-tree drift, iframe/API v3 compatibility, and shared convention checks. Use --workspace-only for CI gates that should fail only on workspace-scoped checks while keeping environment failures advisory. Use --wp-version-check to compare generated feature floors with plugin bootstrap headers."
4347
4411
  ],
4348
- heading: "Usage: wp-typia doctor [--format json] [--workspace-only]",
4412
+ heading: "Usage: wp-typia doctor [--format json] [--workspace-only] [--wp-version-check]",
4349
4413
  optionMetadata: DOCTOR_OPTION_METADATA
4350
4414
  },
4351
4415
  mcp: {
@@ -5945,4 +6009,4 @@ export {
5945
6009
  runGunshiCli
5946
6010
  };
5947
6011
 
5948
- //# debugId=23F1B8999F88E0E464756E2164756E21
6012
+ //# debugId=DA4A175C5AECCFDA64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-typia",
3
- "version": "0.24.7",
3
+ "version": "0.24.9",
4
4
  "description": "Canonical CLI package for wp-typia scaffolding and project workflows",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -56,7 +56,7 @@
56
56
  "dependencies": {
57
57
  "@gunshi/plugin-completion": "0.32.0",
58
58
  "@wp-typia/api-client": "^0.4.6",
59
- "@wp-typia/project-tools": "0.24.6",
59
+ "@wp-typia/project-tools": "0.24.7",
60
60
  "gunshi": "0.32.0",
61
61
  "zod": "4.3.6"
62
62
  },