wp-typia 0.24.2 → 0.24.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.
@@ -620,7 +620,11 @@ function resolveCommandOptionValues(metadata, options) {
620
620
  continue;
621
621
  }
622
622
  if (descriptor.repeatable && Array.isArray(value)) {
623
- resolved[name] = value.every((item) => typeof item === "string") ? value.join(",") : undefined;
623
+ if (!value.every((item) => typeof item === "string")) {
624
+ resolved[name] = undefined;
625
+ continue;
626
+ }
627
+ resolved[name] = options.preserveArrays ? [...value] : value.join(",");
624
628
  continue;
625
629
  }
626
630
  resolved[name] = typeof value === "string" ? value : undefined;
@@ -989,7 +993,9 @@ var PATTERN_CATALOG_VISIBLE_FIELDS = [
989
993
  "name",
990
994
  "scope",
991
995
  "section-role",
992
- "catalog-title"
996
+ "catalog-title",
997
+ "tags",
998
+ "thumbnail-url"
993
999
  ];
994
1000
  var NAME_SOURCE_VISIBLE_FIELDS = [
995
1001
  "kind",
@@ -1468,6 +1474,10 @@ import {
1468
1474
  var CORE_VARIATION_MISSING_NAME_MESSAGE = "`wp-typia add core-variation` requires <name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
1469
1475
  var CORE_VARIATION_MISSING_BLOCK_MESSAGE = "`wp-typia add core-variation` requires <block-name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
1470
1476
  var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
1477
+ var CORE_VARIATION_POSITIONAL_TARGET_DIAGNOSTICS = {
1478
+ empty: () => "The first positional argument (target block name) requires a block name.",
1479
+ invalidFormat: () => "The first positional argument (target block name) must use <namespace/block-slug> format."
1480
+ };
1471
1481
  function formatCoreVariationMissingPositionalNameMessage(blockName) {
1472
1482
  return [
1473
1483
  `\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
@@ -1485,6 +1495,7 @@ function resolveCoreVariationInputs(context) {
1485
1495
  }
1486
1496
  return {
1487
1497
  targetBlockName: positionalTargetBlockName,
1498
+ targetBlockNameDiagnostics: CORE_VARIATION_POSITIONAL_TARGET_DIAGNOSTICS,
1488
1499
  variationName: positionalVariationName
1489
1500
  };
1490
1501
  }
@@ -1499,6 +1510,7 @@ function resolveCoreVariationInputs(context) {
1499
1510
  }
1500
1511
  return {
1501
1512
  targetBlockName: targetBlockFlag,
1513
+ targetBlockNameDiagnostics: "--block",
1502
1514
  variationName
1503
1515
  };
1504
1516
  }
@@ -1518,11 +1530,12 @@ var coreVariationAddKindEntry = defineAddKindRegistryEntry({
1518
1530
  description: "Add an editor-side variation for an existing core or external block",
1519
1531
  nameLabel: "Variation name",
1520
1532
  async prepareExecution(context) {
1521
- const { targetBlockName, variationName } = resolveCoreVariationInputs(context);
1533
+ const { targetBlockName, targetBlockNameDiagnostics, variationName } = resolveCoreVariationInputs(context);
1522
1534
  return createNamedExecutionPlan(context, {
1523
1535
  execute: ({ cwd, name }) => context.addRuntime.runAddCoreVariationCommand({
1524
1536
  cwd,
1525
1537
  targetBlockName,
1538
+ targetBlockNameDiagnostics,
1526
1539
  variationName: name
1527
1540
  }),
1528
1541
  getValues: (result) => ({
@@ -1701,15 +1714,19 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
1701
1714
  title: "Added workspace pattern"
1702
1715
  },
1703
1716
  description: "Add a PHP block pattern shell",
1704
- hiddenStringSubmitFields: ["tag", "tags", "thumbnail-url"],
1717
+ hiddenStringSubmitFields: ["tag"],
1705
1718
  nameLabel: "Pattern name",
1706
1719
  async prepareExecution(context) {
1707
1720
  const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
1721
+ const rawScope = typeof context.flags.scope === "string" ? context.flags.scope : undefined;
1722
+ const rawSectionRole = typeof context.flags["section-role"] === "string" ? context.flags["section-role"] : undefined;
1723
+ const rawCatalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
1724
+ const rawThumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
1708
1725
  const scope = resolvePatternScopeFlag(context);
1709
1726
  const sectionRole = resolvePatternSectionRoleFlag(context, scope);
1710
- const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
1727
+ const catalogTitle = rawCatalogTitle;
1711
1728
  const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
1712
- const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
1729
+ const thumbnailUrl = rawThumbnailUrl;
1713
1730
  return {
1714
1731
  execute: (cwd) => context.addRuntime.runAddPatternCommand({
1715
1732
  catalogTitle,
@@ -1720,6 +1737,13 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
1720
1737
  tags,
1721
1738
  thumbnailUrl
1722
1739
  }),
1740
+ getDryRunSummaryLines: (result) => buildPatternCatalogDryRunSummaryLines(result, {
1741
+ rawCatalogTitle,
1742
+ rawScope,
1743
+ rawSectionRole,
1744
+ rawTags: tags,
1745
+ rawThumbnailUrl
1746
+ }),
1723
1747
  getValues: (result) => ({
1724
1748
  contentFile: result.contentFile,
1725
1749
  patternSlug: result.patternSlug,
@@ -1783,6 +1807,75 @@ function normalizePatternTagFlags(tagsFlag, tagFlag) {
1783
1807
  ];
1784
1808
  return tags.length > 0 ? tags : undefined;
1785
1809
  }
1810
+ function quoteValue(value) {
1811
+ return `"${value}"`;
1812
+ }
1813
+ function formatTags(tags) {
1814
+ return tags.length > 0 ? tags.join(", ") : "no tags";
1815
+ }
1816
+ function collectPatternTagTokens(tags) {
1817
+ return (tags ?? []).flatMap((tag) => tag.split(",")).map((tag) => tag.trim()).filter((tag) => tag.length > 0);
1818
+ }
1819
+ function valuesMatch(left, right) {
1820
+ return left.length === right.length && left.every((value, index) => value === right[index]);
1821
+ }
1822
+ function createNormalizationNote(options) {
1823
+ const rawValue = options.rawValue;
1824
+ if (rawValue === undefined || rawValue.trim().length === 0 || !options.resolvedValue || rawValue === options.resolvedValue) {
1825
+ return;
1826
+ }
1827
+ return `${options.fieldLabel} normalized from ${quoteValue(rawValue)} to ${quoteValue(options.resolvedValue)}.`;
1828
+ }
1829
+ function collectPatternCatalogNormalizationNotes(result, options) {
1830
+ const notes = [
1831
+ createNormalizationNote({
1832
+ fieldLabel: "Scope",
1833
+ rawValue: options.rawScope,
1834
+ resolvedValue: result.patternScope
1835
+ }),
1836
+ createNormalizationNote({
1837
+ fieldLabel: "Section role",
1838
+ rawValue: options.rawSectionRole,
1839
+ resolvedValue: result.sectionRole
1840
+ }),
1841
+ createNormalizationNote({
1842
+ fieldLabel: "Title",
1843
+ rawValue: options.rawCatalogTitle,
1844
+ resolvedValue: result.title
1845
+ }),
1846
+ createNormalizationNote({
1847
+ fieldLabel: "Thumbnail URL",
1848
+ rawValue: options.rawThumbnailUrl,
1849
+ resolvedValue: result.thumbnailUrl
1850
+ })
1851
+ ].filter((note) => typeof note === "string");
1852
+ const rawTags = collectPatternTagTokens(options.rawTags);
1853
+ if (rawTags.length > 0 && !valuesMatch(rawTags, result.tags)) {
1854
+ notes.push(`Tags normalized from ${quoteValue(formatTags(rawTags))} to ${quoteValue(formatTags(result.tags))}.`);
1855
+ }
1856
+ return notes;
1857
+ }
1858
+ function buildPatternCatalogDryRunSummaryLines(result, options) {
1859
+ const catalogLines = [
1860
+ "",
1861
+ "Catalog metadata:",
1862
+ ` Scope: ${result.patternScope}`,
1863
+ ...result.sectionRole ? [` Section role: ${result.sectionRole}`] : [],
1864
+ ` Title: ${result.title}`,
1865
+ ...result.tags.length > 0 ? [` Tags: ${formatTags(result.tags)}`] : [],
1866
+ ...result.thumbnailUrl ? [` Thumbnail URL: ${result.thumbnailUrl}`] : []
1867
+ ];
1868
+ const normalizationNotes = collectPatternCatalogNormalizationNotes(result, options);
1869
+ if (normalizationNotes.length === 0) {
1870
+ return catalogLines;
1871
+ }
1872
+ return [
1873
+ ...catalogLines,
1874
+ "",
1875
+ "Normalization notes:",
1876
+ ...normalizationNotes.map((note) => ` ${note}`)
1877
+ ];
1878
+ }
1786
1879
 
1787
1880
  // src/add-kinds/post-meta.ts
1788
1881
  var POST_META_MISSING_NAME_MESSAGE = "`wp-typia add post-meta` requires <name>. Usage: wp-typia add post-meta <name> --post-type <post-type> [--type <ExportedTypeName>] [--meta-key <meta-key>].";
@@ -2537,7 +2630,7 @@ function buildStructuredInitSuccessPayload(plan) {
2537
2630
  // package.json
2538
2631
  var package_default = {
2539
2632
  name: "wp-typia",
2540
- version: "0.24.2",
2633
+ version: "0.24.4",
2541
2634
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
2542
2635
  packageManager: "bun@1.3.11",
2543
2636
  type: "module",
@@ -2607,7 +2700,7 @@ var package_default = {
2607
2700
  "@bunli/tui": "0.6.0",
2608
2701
  "@bunli/utils": "0.6.0",
2609
2702
  "@wp-typia/api-client": "^0.4.5",
2610
- "@wp-typia/project-tools": "0.24.2",
2703
+ "@wp-typia/project-tools": "0.24.4",
2611
2704
  "better-result": "^2.7.0",
2612
2705
  react: "^19.2.5",
2613
2706
  "react-dom": "^19.2.5",
@@ -2728,12 +2821,16 @@ function buildAddCompletionPayload(options, markerOptions) {
2728
2821
  }
2729
2822
  function buildAddDryRunPayload(options, markerOptions) {
2730
2823
  const normalizedTitle = stripLeadingOutputMarker(options.completion.title, "success").replace(/^Added\s*/u, "");
2824
+ const summaryLines = [
2825
+ ...options.completion.summaryLines ?? [],
2826
+ ...options.summaryLines ?? []
2827
+ ];
2731
2828
  return {
2732
2829
  optionalLines: options.fileOperations,
2733
2830
  optionalNote: "No workspace files were changed because --dry-run was enabled. Re-run without --dry-run to apply this add command.",
2734
2831
  optionalTitle: `Planned workspace updates (${options.fileOperations.length}):`,
2735
2832
  preambleLines: options.completion.preambleLines,
2736
- summaryLines: options.completion.summaryLines,
2833
+ summaryLines: summaryLines.length > 0 ? summaryLines : undefined,
2737
2834
  title: formatOutputMarker("dryRun", `Dry run for ${normalizedTitle || "workspace add command"}`, markerOptions),
2738
2835
  warningLines: options.completion.warningLines
2739
2836
  };
@@ -2867,7 +2964,8 @@ async function executeWorkspaceAddWithOptionalDryRun(options) {
2867
2964
  }
2868
2965
  return emitCompletion(buildAddDryRunPayload({
2869
2966
  completion,
2870
- fileOperations: simulated.fileOperations
2967
+ fileOperations: simulated.fileOperations,
2968
+ summaryLines: options.buildDryRunSummaryLines?.(result)
2871
2969
  }), {
2872
2970
  emitOutput: options.emitOutput ?? true,
2873
2971
  printLine: options.printLine,
@@ -2882,6 +2980,7 @@ function executePreparedAddKind(kind, context, plan) {
2882
2980
  values: plan.getValues(result),
2883
2981
  warnings: plan.getWarnings?.(result)
2884
2982
  }),
2983
+ buildDryRunSummaryLines: (result) => plan.getDryRunSummaryLines?.(result),
2885
2984
  cwd: context.cwd,
2886
2985
  dryRun: context.dryRun,
2887
2986
  emitOutput: context.emitOutput,
@@ -4360,4 +4459,4 @@ export {
4360
4459
  hasFlagBeforeTerminator
4361
4460
  };
4362
4461
 
4363
- //# debugId=925E6E8A01768B3B64756E2164756E21
4462
+ //# debugId=89953F05ED6BD87364756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-typia",
3
- "version": "0.24.2",
3
+ "version": "0.24.4",
4
4
  "description": "Canonical CLI package for wp-typia scaffolding and project workflows",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -70,7 +70,7 @@
70
70
  "@bunli/tui": "0.6.0",
71
71
  "@bunli/utils": "0.6.0",
72
72
  "@wp-typia/api-client": "^0.4.5",
73
- "@wp-typia/project-tools": "0.24.2",
73
+ "@wp-typia/project-tools": "0.24.4",
74
74
  "better-result": "^2.7.0",
75
75
  "react": "^19.2.5",
76
76
  "react-dom": "^19.2.5",