wp-typia 0.22.3 → 0.22.5

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.
@@ -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.5",
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.5",
85
85
  "better-result": "^2.7.0",
86
86
  react: "^19.2.5",
87
87
  "react-dom": "^19.2.5",
@@ -103,6 +103,51 @@ var package_default = {
103
103
  }
104
104
  };
105
105
 
106
+ // bin/argv-walker.js
107
+ function normalizeOptionSet(values) {
108
+ return values instanceof Set ? values : new Set(values);
109
+ }
110
+ function collectPositionalIndexes(argv, metadata) {
111
+ const longValueOptionSet = normalizeOptionSet(metadata.longValueOptions);
112
+ const shortValueOptionSet = normalizeOptionSet(metadata.shortValueOptions);
113
+ const positionalIndexes = [];
114
+ for (let index = 0;index < argv.length; index += 1) {
115
+ const arg = argv[index];
116
+ if (arg === "--") {
117
+ for (let restIndex = index + 1;restIndex < argv.length; restIndex += 1) {
118
+ positionalIndexes.push(restIndex);
119
+ }
120
+ break;
121
+ }
122
+ if (!arg.startsWith("-") || arg === "-") {
123
+ positionalIndexes.push(index);
124
+ continue;
125
+ }
126
+ if (arg.startsWith("--")) {
127
+ if (arg.includes("=")) {
128
+ continue;
129
+ }
130
+ const next = argv[index + 1];
131
+ if (longValueOptionSet.has(arg) && next && !next.startsWith("-")) {
132
+ index += 1;
133
+ }
134
+ continue;
135
+ }
136
+ if (arg.length === 2 && shortValueOptionSet.has(arg) && argv[index + 1] && !argv[index + 1].startsWith("-")) {
137
+ index += 1;
138
+ }
139
+ }
140
+ return positionalIndexes;
141
+ }
142
+ function findFirstPositionalIndex(argv, metadata) {
143
+ const positionalIndexes = collectPositionalIndexes(argv, metadata);
144
+ return positionalIndexes[0] ?? -1;
145
+ }
146
+ function findFirstPositional(argv, metadata) {
147
+ const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
148
+ return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
149
+ }
150
+
106
151
  // src/command-option-metadata.ts
107
152
  var CREATE_OPTION_METADATA = {
108
153
  "alternate-render-targets": {
@@ -334,7 +379,7 @@ var SYNC_OPTION_METADATA = {
334
379
  };
335
380
  var DOCTOR_OPTION_METADATA = {
336
381
  format: {
337
- description: "Use `json` for machine-readable doctor check output.",
382
+ description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
338
383
  type: "string"
339
384
  }
340
385
  };
@@ -351,7 +396,7 @@ var GLOBAL_OPTION_METADATA = {
351
396
  type: "string"
352
397
  },
353
398
  format: {
354
- description: "Output format for supported commands.",
399
+ description: "Output format for supported commands (`json` or `text`).",
355
400
  type: "string"
356
401
  },
357
402
  id: {
@@ -511,55 +556,93 @@ function resolveCommandOptionValues(metadata, options) {
511
556
  return resolved;
512
557
  }
513
558
 
514
- // bin/argv-walker.js
515
- function normalizeOptionSet(values) {
516
- return values instanceof Set ? values : new Set(values);
559
+ // src/cli-command-resolution.ts
560
+ function resolveEntrypointCliCommand(argv) {
561
+ return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
517
562
  }
518
- function collectPositionalIndexes(argv, metadata) {
519
- const longValueOptionSet = normalizeOptionSet(metadata.longValueOptions);
520
- const shortValueOptionSet = normalizeOptionSet(metadata.shortValueOptions);
521
- const positionalIndexes = [];
563
+
564
+ // src/cli-output-format.ts
565
+ var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
566
+ var LEGACY_CLI_OUTPUT_FORMAT_ALIASES = ["toon"];
567
+ var SUPPORTED_CLI_OUTPUT_FORMATS = [
568
+ ...PUBLIC_CLI_OUTPUT_FORMATS,
569
+ ...LEGACY_CLI_OUTPUT_FORMAT_ALIASES
570
+ ];
571
+ var SUPPORTED_CLI_OUTPUT_FORMAT_VALUES = SUPPORTED_CLI_OUTPUT_FORMATS;
572
+ function formatSupportedCliOutputFormats() {
573
+ return PUBLIC_CLI_OUTPUT_FORMATS.join(", ");
574
+ }
575
+ function isSupportedCliOutputFormat(value) {
576
+ return typeof value === "string" && SUPPORTED_CLI_OUTPUT_FORMAT_VALUES.includes(value);
577
+ }
578
+ function normalizeCliOutputFormatArgv(argv) {
579
+ let normalized;
522
580
  for (let index = 0;index < argv.length; index += 1) {
523
581
  const arg = argv[index];
582
+ if (!arg) {
583
+ continue;
584
+ }
524
585
  if (arg === "--") {
525
- for (let restIndex = index + 1;restIndex < argv.length; restIndex += 1) {
526
- positionalIndexes.push(restIndex);
527
- }
528
586
  break;
529
587
  }
530
- if (!arg.startsWith("-") || arg === "-") {
531
- positionalIndexes.push(index);
532
- continue;
533
- }
534
- if (arg.startsWith("--")) {
535
- if (arg.includes("=")) {
536
- continue;
537
- }
588
+ if (arg === "--format") {
538
589
  const next = argv[index + 1];
539
- if (longValueOptionSet.has(arg) && next && !next.startsWith("-")) {
590
+ if (next === "text") {
591
+ normalized ??= [...argv];
592
+ normalized[index + 1] = "toon";
593
+ }
594
+ if (next && !next.startsWith("-")) {
540
595
  index += 1;
541
596
  }
542
597
  continue;
543
598
  }
544
- if (arg.length === 2 && shortValueOptionSet.has(arg) && argv[index + 1] && !argv[index + 1].startsWith("-")) {
545
- index += 1;
599
+ if (arg === "--format=text") {
600
+ normalized ??= [...argv];
601
+ normalized[index] = "--format=toon";
546
602
  }
547
603
  }
548
- return positionalIndexes;
604
+ return normalized ?? argv;
549
605
  }
550
- function findFirstPositionalIndex(argv, metadata) {
551
- const positionalIndexes = collectPositionalIndexes(argv, metadata);
552
- return positionalIndexes[0] ?? -1;
606
+ function formatInvalidCliOutputFormatMessage(value) {
607
+ return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
553
608
  }
554
- function findFirstPositional(argv, metadata) {
555
- const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
556
- return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
609
+ function assertSupportedCliOutputFormat(value, argv) {
610
+ if (isSupportedCliOutputFormat(value)) {
611
+ return;
612
+ }
613
+ throw createCliCommandError({
614
+ code: CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT,
615
+ command: resolveEntrypointCliCommand(argv),
616
+ detailLines: [formatInvalidCliOutputFormatMessage(value)]
617
+ });
618
+ }
619
+ function validateCliOutputFormatArgv(argv) {
620
+ for (let index = 0;index < argv.length; index += 1) {
621
+ const arg = argv[index];
622
+ if (!arg) {
623
+ continue;
624
+ }
625
+ if (arg === "--") {
626
+ return;
627
+ }
628
+ if (arg === "--format") {
629
+ const next = argv[index + 1];
630
+ if (next && !next.startsWith("-")) {
631
+ assertSupportedCliOutputFormat(next, argv);
632
+ index += 1;
633
+ }
634
+ continue;
635
+ }
636
+ if (arg.startsWith("--format=")) {
637
+ const value = arg.slice("--format=".length);
638
+ if (value) {
639
+ assertSupportedCliOutputFormat(value, argv);
640
+ }
641
+ }
642
+ }
557
643
  }
558
644
 
559
645
  // src/cli-diagnostic-output.ts
560
- function resolveEntrypointCliCommand(argv) {
561
- return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
562
- }
563
646
  function writeStructuredCliJsonToStderr(payload) {
564
647
  process.stderr.write(`${JSON.stringify(payload, null, 2)}
565
648
  `);
@@ -583,7 +666,10 @@ function prefersStructuredCliArgv(argv) {
583
666
  return false;
584
667
  }
585
668
  function prefersStructuredCliOutput(args) {
586
- return args.formatExplicit && args.format !== "toon" || Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
669
+ if (args.formatExplicit) {
670
+ return args.format === "json" && isSupportedCliOutputFormat(args.format);
671
+ }
672
+ return Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
587
673
  }
588
674
  function emitCliDiagnosticFailure(args, options) {
589
675
  const diagnostic = createCliCommandError(options);
@@ -852,6 +938,6 @@ function getMcpSchemaSources(config) {
852
938
  function createPlugin(input) {
853
939
  return input;
854
940
  }
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 };
941
+ export { createPlugin, package_default, collectPositionalIndexes, findFirstPositionalIndex, 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, normalizeCliOutputFormatArgv, 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
942
 
857
- //# debugId=CC09AC809AED3B1A64756E2164756E21
943
+ //# debugId=B9D55210C12B16C464756E2164756E21
@@ -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-ctddkm3n.js";
23
23
  import"./cli-1sm60g1z.js";
24
- import"./cli-prc42zqd.js";
25
- import"./cli-gcbre1zs.js";
24
+ import"./cli-xbzfx7qz.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-j30rk466.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
@@ -45,20 +45,20 @@ import {
45
45
  setValueAtPath,
46
46
  writeInitialMigrationScaffold,
47
47
  writeMigrationConfig
48
- } from "./cli-gcbre1zs.js";
48
+ } from "./cli-hb9vpsev.js";
49
49
  import {
50
50
  createReadlinePrompt
51
51
  } from "./cli-bq2v559b.js";
52
- import {
53
- formatRunScript
54
- } from "./cli-sj5mtyzj.js";
55
52
  import {
56
53
  readWorkspaceInventory
57
- } from "./cli-x0h03qqe.js";
54
+ } from "./cli-j30rk466.js";
58
55
  import {
59
56
  getInvalidWorkspaceProjectReason,
60
57
  tryResolveWorkspaceProject
61
- } from "./cli-pd5pqgre.js";
58
+ } from "./cli-btbpt84c.js";
59
+ import {
60
+ formatRunScript
61
+ } from "./cli-6bhfzq5e.js";
62
62
 
63
63
  // ../wp-typia-project-tools/src/runtime/migrations.ts
64
64
  import fs8 from "fs";
@@ -2603,4 +2603,4 @@ function seedProjectMigrations(projectDir, currentMigrationVersion, blocks, { re
2603
2603
 
2604
2604
  export { formatMigrationHelpText, parseMigrationArgs, formatDiffReport, verifyProjectMigrations, doctorProjectMigrations, fixturesProjectMigrations, fuzzProjectMigrations, runMigrationCommand, planProjectMigrations, wizardProjectMigrations, initProjectMigrations, snapshotProjectVersion, diffProjectMigrations, scaffoldProjectMigrations, seedProjectMigrations };
2605
2605
 
2606
- //# debugId=BC365CDF987C339064756E2164756E21
2606
+ //# debugId=BE1EB867745EABB564756E2164756E21
package/dist-bunli/cli.js CHANGED
@@ -17,9 +17,11 @@ import {
17
17
  loadWpTypiaUserConfig,
18
18
  loadWpTypiaUserConfigFromSource,
19
19
  mergeWpTypiaUserConfig,
20
+ normalizeCliOutputFormatArgv,
20
21
  package_default,
22
+ validateCliOutputFormatArgv,
21
23
  writeStructuredCliDiagnosticError
22
- } from "./cli-mpgt29xc.js";
24
+ } from "./cli-nzwpmw4y.js";
23
25
  import"./cli-03j0axbt.js";
24
26
  import {
25
27
  GLOBAL_FLAGS,
@@ -2453,7 +2455,7 @@ async function formatCliError(error) {
2453
2455
  }
2454
2456
  async function createWpTypiaCli(options = {}) {
2455
2457
  applyStandaloneSupportLayoutEnv();
2456
- const { wpTypiaCommands } = await import("./command-list-wzej5c7v.js");
2458
+ const { wpTypiaCommands } = await import("./command-list-scd6zqp8.js");
2457
2459
  const cli = await createCLI({
2458
2460
  ...bunliConfig,
2459
2461
  description: package_default.description,
@@ -2487,8 +2489,9 @@ async function createWpTypiaCli(options = {}) {
2487
2489
  async function main(argv = process.argv.slice(2)) {
2488
2490
  const normalizedArgv = normalizeWpTypiaArgv(argv);
2489
2491
  const { argv: cliArgv, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
2492
+ validateCliOutputFormatArgv(cliArgv);
2490
2493
  const cli = await createWpTypiaCli({ configOverridePath });
2491
- await cli.run(cliArgv);
2494
+ await cli.run(normalizeCliOutputFormatArgv(cliArgv));
2492
2495
  }
2493
2496
  async function runCliEntrypoint(argv = process.argv.slice(2)) {
2494
2497
  try {
@@ -2512,4 +2515,4 @@ export {
2512
2515
  createWpTypiaCli
2513
2516
  };
2514
2517
 
2515
- //# debugId=5EFFD418326B0BAA64756E2164756E21
2518
+ //# debugId=47FFF7F809C451D764756E2164756E21