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.
@@ -1,4 +1,9 @@
1
1
  // @bun
2
+ import {
3
+ hasExecutablePattern,
4
+ hasUncommentedPattern,
5
+ maskTypeScriptCommentsAndLiterals
6
+ } from "./cli-rwjkqjhs.js";
2
7
  import {
3
8
  getBuiltInTemplateLayerDirs,
4
9
  isOmittableBuiltInTemplateLayerDir
@@ -16,7 +21,7 @@ import {
16
21
  escapeRegex,
17
22
  readWorkspaceInventory,
18
23
  resolveEditorPluginSlotAlias
19
- } from "./cli-x0h03qqe.js";
24
+ } from "./cli-qr2ek735.js";
20
25
  import"./cli-t73q5aqz.js";
21
26
  import {
22
27
  CLI_DIAGNOSTIC_CODES,
@@ -30,7 +35,8 @@ import {
30
35
  getInvalidWorkspaceProjectReason,
31
36
  parseWorkspacePackageJson,
32
37
  tryResolveWorkspaceProject
33
- } from "./cli-pd5pqgre.js";
38
+ } from "./cli-btbpt84c.js";
39
+ import"./cli-6bhfzq5e.js";
34
40
  import"./cli-xnn9xjcy.js";
35
41
 
36
42
  // ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
@@ -324,67 +330,6 @@ var WORKSPACE_BLOCK_LOCAL_STYLE_FILES = [
324
330
  ];
325
331
  var WORKSPACE_BLOCK_IFRAME_GLOBAL_DOM_PATTERN = /\b(?:document|window)\b|\b(?:parent|top)\b(?!\s*:)/gu;
326
332
  var WORKSPACE_BLOCK_PROPS_PATTERN = /\buse(?:Block|InnerBlocks)Props(?:\.save)?\s*\(/u;
327
- function maskSourceSegment(segment) {
328
- return segment.replace(/[^\n\r]/gu, " ");
329
- }
330
- function maskTypeScriptComments(source) {
331
- return source.replace(/\/\*[\s\S]*?\*\//gu, maskSourceSegment).replace(/\/\/[^\n\r]*/gu, maskSourceSegment);
332
- }
333
- function maskTypeScriptCommentsAndLiterals(source) {
334
- let maskedSource = "";
335
- let index = 0;
336
- while (index < source.length) {
337
- const current = source[index];
338
- const next = source[index + 1];
339
- if (current === "/" && next === "/") {
340
- const start = index;
341
- index += 2;
342
- while (index < source.length && source[index] !== `
343
- ` && source[index] !== "\r") {
344
- index += 1;
345
- }
346
- maskedSource += maskSourceSegment(source.slice(start, index));
347
- continue;
348
- }
349
- if (current === "/" && next === "*") {
350
- const start = index;
351
- index += 2;
352
- while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) {
353
- index += 1;
354
- }
355
- index = Math.min(index + 2, source.length);
356
- maskedSource += maskSourceSegment(source.slice(start, index));
357
- continue;
358
- }
359
- if (current === "'" || current === '"' || current === "`") {
360
- const start = index;
361
- const quote = current;
362
- index += 1;
363
- while (index < source.length) {
364
- const char = source[index];
365
- if (char === "\\") {
366
- index += 2;
367
- continue;
368
- }
369
- index += 1;
370
- if (char === quote) {
371
- break;
372
- }
373
- }
374
- maskedSource += maskSourceSegment(source.slice(start, index));
375
- continue;
376
- }
377
- maskedSource += current;
378
- index += 1;
379
- }
380
- return maskedSource;
381
- }
382
- function hasUncommentedPattern(source, pattern) {
383
- return pattern.test(maskTypeScriptComments(source));
384
- }
385
- function hasExecutablePattern(source, pattern) {
386
- return pattern.test(maskTypeScriptCommentsAndLiterals(source));
387
- }
388
333
  function normalizePathSeparators(relativePath) {
389
334
  return relativePath.split(path4.sep).join("/");
390
335
  }
@@ -1172,4 +1117,4 @@ export {
1172
1117
  getDoctorChecks
1173
1118
  };
1174
1119
 
1175
- //# debugId=A8225043978E779064756E2164756E21
1120
+ //# debugId=08A020B4B453391764756E2164756E21
@@ -11,7 +11,7 @@ import {
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "wp-typia",
14
- version: "0.22.3",
14
+ version: "0.22.4",
15
15
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
16
16
  packageManager: "bun@1.3.11",
17
17
  type: "module",
@@ -81,7 +81,7 @@ var package_default = {
81
81
  "@bunli/tui": "0.6.0",
82
82
  "@bunli/utils": "0.6.0",
83
83
  "@wp-typia/api-client": "^0.4.5",
84
- "@wp-typia/project-tools": "0.22.3",
84
+ "@wp-typia/project-tools": "0.22.4",
85
85
  "better-result": "^2.7.0",
86
86
  react: "^19.2.5",
87
87
  "react-dom": "^19.2.5",
@@ -334,7 +334,7 @@ var SYNC_OPTION_METADATA = {
334
334
  };
335
335
  var DOCTOR_OPTION_METADATA = {
336
336
  format: {
337
- description: "Use `json` for machine-readable doctor check output.",
337
+ description: "Use `json` for machine-readable doctor check output or `toon` for human-readable output.",
338
338
  type: "string"
339
339
  }
340
340
  };
@@ -351,7 +351,7 @@ var GLOBAL_OPTION_METADATA = {
351
351
  type: "string"
352
352
  },
353
353
  format: {
354
- description: "Output format for supported commands.",
354
+ description: "Output format for supported commands (`json` or `toon`).",
355
355
  type: "string"
356
356
  },
357
357
  id: {
@@ -556,10 +556,60 @@ function findFirstPositional(argv, metadata) {
556
556
  return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
557
557
  }
558
558
 
559
- // src/cli-diagnostic-output.ts
559
+ // src/cli-output-format.ts
560
+ var SUPPORTED_CLI_OUTPUT_FORMATS = ["json", "toon"];
561
+ function formatSupportedCliOutputFormats() {
562
+ return SUPPORTED_CLI_OUTPUT_FORMATS.join(", ");
563
+ }
564
+ function isSupportedCliOutputFormat(value) {
565
+ return SUPPORTED_CLI_OUTPUT_FORMATS.includes(value);
566
+ }
567
+ function formatInvalidCliOutputFormatMessage(value) {
568
+ return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
569
+ }
560
570
  function resolveEntrypointCliCommand(argv) {
561
571
  return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
562
572
  }
573
+ function assertSupportedCliOutputFormat(value, argv) {
574
+ if (isSupportedCliOutputFormat(value)) {
575
+ return;
576
+ }
577
+ throw createCliCommandError({
578
+ code: CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT,
579
+ command: resolveEntrypointCliCommand(argv),
580
+ detailLines: [formatInvalidCliOutputFormatMessage(value)]
581
+ });
582
+ }
583
+ function validateCliOutputFormatArgv(argv) {
584
+ for (let index = 0;index < argv.length; index += 1) {
585
+ const arg = argv[index];
586
+ if (!arg) {
587
+ continue;
588
+ }
589
+ if (arg === "--") {
590
+ return;
591
+ }
592
+ if (arg === "--format") {
593
+ const next = argv[index + 1];
594
+ if (next && !next.startsWith("-")) {
595
+ assertSupportedCliOutputFormat(next, argv);
596
+ index += 1;
597
+ }
598
+ continue;
599
+ }
600
+ if (arg.startsWith("--format=")) {
601
+ const value = arg.slice("--format=".length);
602
+ if (value) {
603
+ assertSupportedCliOutputFormat(value, argv);
604
+ }
605
+ }
606
+ }
607
+ }
608
+
609
+ // src/cli-diagnostic-output.ts
610
+ function resolveEntrypointCliCommand2(argv) {
611
+ return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
612
+ }
563
613
  function writeStructuredCliJsonToStderr(payload) {
564
614
  process.stderr.write(`${JSON.stringify(payload, null, 2)}
565
615
  `);
@@ -583,7 +633,7 @@ function prefersStructuredCliArgv(argv) {
583
633
  return false;
584
634
  }
585
635
  function prefersStructuredCliOutput(args) {
586
- return args.formatExplicit && args.format !== "toon" || Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
636
+ return args.formatExplicit && args.format === "json" && isSupportedCliOutputFormat(args.format) || Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
587
637
  }
588
638
  function emitCliDiagnosticFailure(args, options) {
589
639
  const diagnostic = createCliCommandError(options);
@@ -604,7 +654,7 @@ function writeStructuredCliDiagnosticError(argv, error) {
604
654
  }
605
655
  writeStructuredCliJsonToStderr({
606
656
  error: serializeCliDiagnosticError(createCliCommandError({
607
- command: resolveEntrypointCliCommand(argv),
657
+ command: resolveEntrypointCliCommand2(argv),
608
658
  error
609
659
  })),
610
660
  ok: false
@@ -852,6 +902,6 @@ function getMcpSchemaSources(config) {
852
902
  function createPlugin(input) {
853
903
  return input;
854
904
  }
855
- export { createPlugin, package_default, CREATE_OPTION_METADATA, ADD_OPTION_METADATA, INIT_OPTION_METADATA, MIGRATE_OPTION_METADATA, MCP_OPTION_METADATA, SYNC_OPTION_METADATA, DOCTOR_OPTION_METADATA, TEMPLATES_OPTION_METADATA, GLOBAL_OPTION_METADATA, COMMAND_OPTION_METADATA_BY_GROUP, ALL_COMMAND_OPTION_METADATA, buildCommandOptions, collectOptionNamesByType, buildCommandOptionParser, COMMAND_ROUTING_METADATA, extractKnownOptionValuesFromArgv, resolveCommandOptionValues, collectPositionalIndexes, findFirstPositionalIndex, prefersStructuredCliOutput, emitCliDiagnosticFailure, writeStructuredCliDiagnosticError, ADD_KIND_IDS, WP_TYPIA_CANONICAL_CREATE_USAGE, WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND, WP_TYPIA_CONFIG_SOURCES, mergeWpTypiaUserConfig, loadWpTypiaUserConfigFromSource, loadWpTypiaUserConfig, getCreateDefaults, getAddBlockDefaults, getMcpSchemaSources };
905
+ export { createPlugin, package_default, CREATE_OPTION_METADATA, ADD_OPTION_METADATA, INIT_OPTION_METADATA, MIGRATE_OPTION_METADATA, MCP_OPTION_METADATA, SYNC_OPTION_METADATA, DOCTOR_OPTION_METADATA, TEMPLATES_OPTION_METADATA, GLOBAL_OPTION_METADATA, COMMAND_OPTION_METADATA_BY_GROUP, ALL_COMMAND_OPTION_METADATA, buildCommandOptions, collectOptionNamesByType, buildCommandOptionParser, COMMAND_ROUTING_METADATA, extractKnownOptionValuesFromArgv, resolveCommandOptionValues, collectPositionalIndexes, findFirstPositionalIndex, validateCliOutputFormatArgv, prefersStructuredCliOutput, emitCliDiagnosticFailure, writeStructuredCliDiagnosticError, ADD_KIND_IDS, WP_TYPIA_CANONICAL_CREATE_USAGE, WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND, WP_TYPIA_CONFIG_SOURCES, mergeWpTypiaUserConfig, loadWpTypiaUserConfigFromSource, loadWpTypiaUserConfig, getCreateDefaults, getAddBlockDefaults, getMcpSchemaSources };
856
906
 
857
- //# debugId=CC09AC809AED3B1A64756E2164756E21
907
+ //# debugId=6F7F012C6A86461164756E2164756E21
@@ -1,7 +1,9 @@
1
1
  // @bun
2
2
  import {
3
- formatRunScript
4
- } from "./cli-sj5mtyzj.js";
3
+ formatRunScript,
4
+ inferPackageManagerId,
5
+ parsePackageManagerField
6
+ } from "./cli-6bhfzq5e.js";
5
7
  import {
6
8
  __reExport
7
9
  } from "./cli-xnn9xjcy.js";
@@ -171,16 +173,7 @@ function runProjectScriptIfPresent(projectDir, scriptName) {
171
173
  }
172
174
  function detectPackageManagerId(projectDir) {
173
175
  const packageJson = readJson(path.join(projectDir, "package.json"));
174
- const field = String(packageJson.packageManager ?? "");
175
- if (field.startsWith("bun@"))
176
- return "bun";
177
- if (field.startsWith("npm@"))
178
- return "npm";
179
- if (field.startsWith("pnpm@"))
180
- return "pnpm";
181
- if (field.startsWith("yarn@"))
182
- return "yarn";
183
- return "bun";
176
+ return parsePackageManagerField(packageJson.packageManager) ?? inferPackageManagerId(projectDir);
184
177
  }
185
178
  function getLocalTsxBinary(projectDir) {
186
179
  const filename = process.platform === "win32" ? "tsx.cmd" : "tsx";
@@ -1267,4 +1260,4 @@ export default migrationConfig;
1267
1260
  }
1268
1261
  export { isPlainObject, stableJsonStringify, exports_json_utils, getValueAtPath, setValueAtPath, deleteValueAtPath, createFixtureScalarValue, createTransformFixtureValue, readJson, renderPhpValue, copyFile, sanitizeSaveSnapshotSource, sanitizeSnapshotBlockJson, runProjectScriptIfPresent, detectPackageManagerId, getLocalTsxBinary, isInteractiveTerminal, resolveTargetMigrationVersion, assertMigrationVersionLabel, compareMigrationVersionLabels, formatLegacyMigrationWorkspaceResetGuidance, escapeForCode, renderObjectKey, isNumber, parseMigrationConfig, ROOT_PHP_MIGRATION_REGISTRY, SNAPSHOT_DIR, MIGRATION_TODO_PREFIX, ensureAdvancedMigrationProject, discoverMigrationInitLayout, getProjectPaths, getSnapshotRoot, getSnapshotBlockJsonPath, getSnapshotManifestPath, getAvailableSnapshotVersionsForBlock, createMissingBlockSnapshotMessage, getSnapshotSavePath, getGeneratedDirForBlock, getRuleFilePath, getFixtureFilePath, ensureMigrationDirectories, discoverMigrationEntries, assertRuleHasNoTodos, readRuleMetadata, writeInitialMigrationScaffold, assertNoLegacySemverMigrationWorkspace, loadMigrationProject, writeMigrationConfig };
1269
1262
 
1270
- //# debugId=04608B59EE49957264756E2164756E21
1263
+ //# debugId=D28E1D6B4C0330A964756E2164756E21
@@ -4,14 +4,7 @@ import {
4
4
  } from "./cli-1sm60g1z.js";
5
5
  import {
6
6
  discoverMigrationInitLayout
7
- } from "./cli-gcbre1zs.js";
8
- import {
9
- formatAddDevDependenciesCommand,
10
- formatPackageExecCommand,
11
- formatRunScript,
12
- getPackageManager,
13
- transformPackageManagerText
14
- } from "./cli-sj5mtyzj.js";
7
+ } from "./cli-hb9vpsev.js";
15
8
  import"./cli-tke8twkn.js";
16
9
  import {
17
10
  quoteTsString,
@@ -20,7 +13,7 @@ import {
20
13
  snapshotWorkspaceFiles,
21
14
  toPascalCase,
22
15
  updateWorkspaceInventorySource
23
- } from "./cli-x0h03qqe.js";
16
+ } from "./cli-qr2ek735.js";
24
17
  import {
25
18
  CLI_DIAGNOSTIC_CODES,
26
19
  createCliDiagnosticCodeError
@@ -28,7 +21,14 @@ import {
28
21
  import {
29
22
  parseWorkspacePackageManagerId,
30
23
  tryResolveWorkspaceProject
31
- } from "./cli-pd5pqgre.js";
24
+ } from "./cli-btbpt84c.js";
25
+ import {
26
+ formatAddDevDependenciesCommand,
27
+ formatPackageExecCommand,
28
+ formatRunScript,
29
+ getPackageManager,
30
+ transformPackageManagerText
31
+ } from "./cli-6bhfzq5e.js";
32
32
  import {
33
33
  __toESM
34
34
  } from "./cli-xnn9xjcy.js";
@@ -841,4 +841,4 @@ export {
841
841
  applyInitPlan
842
842
  };
843
843
 
844
- //# debugId=5F125D72345735E864756E2164756E21
844
+ //# debugId=E7F537E7B32AAF5464756E2164756E21