wp-typia 0.22.4 → 0.22.6
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.
- package/README.md +7 -0
- package/dist-bunli/.bunli/commands.gen.js +2097 -1366
- package/dist-bunli/{cli-2mt6bvcj.js → cli-0q0tz4dq.js} +4 -4
- package/dist-bunli/{cli-hb9vpsev.js → cli-2rqf6t0b.js} +1 -1
- package/dist-bunli/{cli-6bhfzq5e.js → cli-52ke0ptp.js} +2 -2
- package/dist-bunli/{cli-qr2ek735.js → cli-5kn2p7ee.js} +942 -477
- package/dist-bunli/{cli-6ymn63t4.js → cli-6a65qfb1.js} +475 -249
- package/dist-bunli/{cli-add-6s6kzf7x.js → cli-add-5vmxpgmn.js} +94 -184
- package/dist-bunli/{cli-doctor-70zd5m3b.js → cli-doctor-ngzs8kkc.js} +15 -18
- package/dist-bunli/{cli-gsj6vyn5.js → cli-f44sphgv.js} +183 -81
- package/dist-bunli/cli-fys8vm2t.js +20 -0
- package/dist-bunli/{cli-btbpt84c.js → cli-hhp1d348.js} +1 -1
- package/dist-bunli/{cli-init-kjjyky1y.js → cli-init-df1wg71p.js} +421 -401
- package/dist-bunli/{cli-scaffold-f57ccf5v.js → cli-scaffold-btx3wfsn.js} +8 -7
- package/dist-bunli/cli.js +10 -7
- package/dist-bunli/{command-list-wsaa4t2p.js → command-list-bqr2tp8w.js} +16 -12
- package/dist-bunli/{migrations-vw502qf9.js → migrations-bnrjw4k1.js} +7 -6
- package/dist-bunli/node-cli.js +318 -189
- package/dist-bunli/{workspace-project-7826tewa.js → workspace-project-csnnggz6.js} +2 -2
- package/package.json +2 -2
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
escapeRegex,
|
|
22
22
|
readWorkspaceInventory,
|
|
23
23
|
resolveEditorPluginSlotAlias
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-5kn2p7ee.js";
|
|
25
25
|
import"./cli-t73q5aqz.js";
|
|
26
|
+
import"./cli-fys8vm2t.js";
|
|
26
27
|
import {
|
|
27
28
|
CLI_DIAGNOSTIC_CODES,
|
|
28
29
|
createCliCommandError,
|
|
@@ -35,8 +36,8 @@ import {
|
|
|
35
36
|
getInvalidWorkspaceProjectReason,
|
|
36
37
|
parseWorkspacePackageJson,
|
|
37
38
|
tryResolveWorkspaceProject
|
|
38
|
-
} from "./cli-
|
|
39
|
-
import"./cli-
|
|
39
|
+
} from "./cli-hhp1d348.js";
|
|
40
|
+
import"./cli-52ke0ptp.js";
|
|
40
41
|
import"./cli-xnn9xjcy.js";
|
|
41
42
|
|
|
42
43
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
|
|
@@ -175,6 +176,9 @@ function createDoctorScopeCheck(status, detail) {
|
|
|
175
176
|
function getWorkspaceBootstrapRelativePath(packageName) {
|
|
176
177
|
return `${packageName.split("/").pop() ?? packageName}.php`;
|
|
177
178
|
}
|
|
179
|
+
function resolveWorkspaceBootstrapPath(projectDir, packageName) {
|
|
180
|
+
return path2.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
|
|
181
|
+
}
|
|
178
182
|
function checkExistingFiles(projectDir, label, filePaths) {
|
|
179
183
|
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs2.existsSync(path2.join(projectDir, filePath)));
|
|
180
184
|
return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
|
|
@@ -182,8 +186,7 @@ function checkExistingFiles(projectDir, label, filePaths) {
|
|
|
182
186
|
|
|
183
187
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
|
|
184
188
|
function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
185
|
-
const
|
|
186
|
-
const bootstrapPath = path3.join(projectDir, `${packageBaseName}.php`);
|
|
189
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
187
190
|
if (!fs3.existsSync(bootstrapPath)) {
|
|
188
191
|
return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path3.basename(bootstrapPath)}`);
|
|
189
192
|
}
|
|
@@ -558,8 +561,7 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
|
|
|
558
561
|
];
|
|
559
562
|
}
|
|
560
563
|
function checkWorkspacePatternBootstrap(projectDir, packageName) {
|
|
561
|
-
const
|
|
562
|
-
const bootstrapPath = path4.join(projectDir, `${packageBaseName}.php`);
|
|
564
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
563
565
|
if (!fs4.existsSync(bootstrapPath)) {
|
|
564
566
|
return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path4.basename(bootstrapPath)}`);
|
|
565
567
|
}
|
|
@@ -715,8 +717,7 @@ function checkWorkspaceRestResourceConfig(restResource) {
|
|
|
715
717
|
return createDoctorCheck2(`REST resource config ${restResource.slug}`, hasNamespace && hasMethods ? "pass" : "fail", hasNamespace && hasMethods ? `REST resource namespace ${restResource.namespace} with methods ${restResource.methods.join(", ")}` : "REST resource namespace or methods are invalid");
|
|
716
718
|
}
|
|
717
719
|
function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
|
|
718
|
-
const
|
|
719
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
720
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
720
721
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
721
722
|
return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
722
723
|
}
|
|
@@ -755,8 +756,7 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
|
755
756
|
}
|
|
756
757
|
}
|
|
757
758
|
function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
|
|
758
|
-
const
|
|
759
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
759
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
760
760
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
761
761
|
return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
762
762
|
}
|
|
@@ -811,8 +811,7 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
|
|
|
811
811
|
return createDoctorCheck2(`AI feature config ${aiFeature.slug}`, hasNamespace ? "pass" : "fail", hasNamespace ? `AI feature namespace ${aiFeature.namespace} is valid` : "AI feature namespace is invalid");
|
|
812
812
|
}
|
|
813
813
|
function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
|
|
814
|
-
const
|
|
815
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
814
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
816
815
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
817
816
|
return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
818
817
|
}
|
|
@@ -840,8 +839,7 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
|
|
|
840
839
|
return createDoctorCheck2(`Editor plugin config ${editorPlugin.slug}`, isValidSlot ? "pass" : "fail", isValidSlot ? `Editor plugin slot ${editorPlugin.slot} is supported as ${normalizedSlot}` : `Unsupported editor plugin slot "${editorPlugin.slot}". Expected one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")} or legacy aliases PluginSidebar, PluginDocumentSettingPanel.`);
|
|
841
840
|
}
|
|
842
841
|
function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
|
|
843
|
-
const
|
|
844
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
842
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
845
843
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
846
844
|
return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
847
845
|
}
|
|
@@ -895,8 +893,7 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
|
|
|
895
893
|
return createDoctorCheck2(`Admin view config ${adminView.slug}`, isValid ? "pass" : "fail", isValid ? `Admin view source ${source} is list-capable` : "Admin view source must use rest-resource:<slug> with a list-capable REST resource or core-data:<postType|taxonomy>/<name>");
|
|
896
894
|
}
|
|
897
895
|
function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
|
|
898
|
-
const
|
|
899
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
896
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
900
897
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
901
898
|
return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
902
899
|
}
|
|
@@ -1117,4 +1114,4 @@ export {
|
|
|
1117
1114
|
getDoctorChecks
|
|
1118
1115
|
};
|
|
1119
1116
|
|
|
1120
|
-
//# debugId=
|
|
1117
|
+
//# debugId=3C7A7D362A24E1A964756E2164756E21
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
exports_external
|
|
4
4
|
} from "./cli-hv2yedw2.js";
|
|
5
|
+
import {
|
|
6
|
+
ADD_KIND_IDS
|
|
7
|
+
} from "./cli-fys8vm2t.js";
|
|
5
8
|
import {
|
|
6
9
|
CLI_DIAGNOSTIC_CODES,
|
|
7
10
|
createCliCommandError,
|
|
@@ -11,7 +14,7 @@ import {
|
|
|
11
14
|
// package.json
|
|
12
15
|
var package_default = {
|
|
13
16
|
name: "wp-typia",
|
|
14
|
-
version: "0.22.
|
|
17
|
+
version: "0.22.6",
|
|
15
18
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
16
19
|
packageManager: "bun@1.3.11",
|
|
17
20
|
type: "module",
|
|
@@ -81,7 +84,7 @@ var package_default = {
|
|
|
81
84
|
"@bunli/tui": "0.6.0",
|
|
82
85
|
"@bunli/utils": "0.6.0",
|
|
83
86
|
"@wp-typia/api-client": "^0.4.5",
|
|
84
|
-
"@wp-typia/project-tools": "0.22.
|
|
87
|
+
"@wp-typia/project-tools": "0.22.6",
|
|
85
88
|
"better-result": "^2.7.0",
|
|
86
89
|
react: "^19.2.5",
|
|
87
90
|
"react-dom": "^19.2.5",
|
|
@@ -103,6 +106,51 @@ var package_default = {
|
|
|
103
106
|
}
|
|
104
107
|
};
|
|
105
108
|
|
|
109
|
+
// bin/argv-walker.js
|
|
110
|
+
function normalizeOptionSet(values) {
|
|
111
|
+
return values instanceof Set ? values : new Set(values);
|
|
112
|
+
}
|
|
113
|
+
function collectPositionalIndexes(argv, metadata) {
|
|
114
|
+
const longValueOptionSet = normalizeOptionSet(metadata.longValueOptions);
|
|
115
|
+
const shortValueOptionSet = normalizeOptionSet(metadata.shortValueOptions);
|
|
116
|
+
const positionalIndexes = [];
|
|
117
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
118
|
+
const arg = argv[index];
|
|
119
|
+
if (arg === "--") {
|
|
120
|
+
for (let restIndex = index + 1;restIndex < argv.length; restIndex += 1) {
|
|
121
|
+
positionalIndexes.push(restIndex);
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
if (!arg.startsWith("-") || arg === "-") {
|
|
126
|
+
positionalIndexes.push(index);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (arg.startsWith("--")) {
|
|
130
|
+
if (arg.includes("=")) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const next = argv[index + 1];
|
|
134
|
+
if (longValueOptionSet.has(arg) && next && !next.startsWith("-")) {
|
|
135
|
+
index += 1;
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (arg.length === 2 && shortValueOptionSet.has(arg) && argv[index + 1] && !argv[index + 1].startsWith("-")) {
|
|
140
|
+
index += 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return positionalIndexes;
|
|
144
|
+
}
|
|
145
|
+
function findFirstPositionalIndex(argv, metadata) {
|
|
146
|
+
const positionalIndexes = collectPositionalIndexes(argv, metadata);
|
|
147
|
+
return positionalIndexes[0] ?? -1;
|
|
148
|
+
}
|
|
149
|
+
function findFirstPositional(argv, metadata) {
|
|
150
|
+
const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
|
|
151
|
+
return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
|
|
152
|
+
}
|
|
153
|
+
|
|
106
154
|
// src/command-option-metadata.ts
|
|
107
155
|
var CREATE_OPTION_METADATA = {
|
|
108
156
|
"alternate-render-targets": {
|
|
@@ -334,7 +382,7 @@ var SYNC_OPTION_METADATA = {
|
|
|
334
382
|
};
|
|
335
383
|
var DOCTOR_OPTION_METADATA = {
|
|
336
384
|
format: {
|
|
337
|
-
description: "Use `json` for machine-readable doctor check output or `
|
|
385
|
+
description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
|
|
338
386
|
type: "string"
|
|
339
387
|
}
|
|
340
388
|
};
|
|
@@ -351,7 +399,7 @@ var GLOBAL_OPTION_METADATA = {
|
|
|
351
399
|
type: "string"
|
|
352
400
|
},
|
|
353
401
|
format: {
|
|
354
|
-
description: "Output format for supported commands (`json` or `
|
|
402
|
+
description: "Output format for supported commands (`json` or `text`).",
|
|
355
403
|
type: "string"
|
|
356
404
|
},
|
|
357
405
|
id: {
|
|
@@ -422,6 +470,9 @@ function buildArgvWalkerRoutingMetadata(...metadataMaps) {
|
|
|
422
470
|
};
|
|
423
471
|
}
|
|
424
472
|
var COMMAND_ROUTING_METADATA = buildArgvWalkerRoutingMetadata(ALL_COMMAND_OPTION_METADATA);
|
|
473
|
+
function createMissingOptionValueError(optionLabel) {
|
|
474
|
+
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`${optionLabel}\` requires a value.`);
|
|
475
|
+
}
|
|
425
476
|
function extractKnownOptionValuesFromArgv(argv, options) {
|
|
426
477
|
const flags = {};
|
|
427
478
|
const nextArgv = [];
|
|
@@ -447,7 +498,7 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
447
498
|
}
|
|
448
499
|
const next = argv[index + 1];
|
|
449
500
|
if (!next || next.startsWith("-")) {
|
|
450
|
-
throw
|
|
501
|
+
throw createMissingOptionValueError(arg);
|
|
451
502
|
}
|
|
452
503
|
flags[shortFlag.name] = next;
|
|
453
504
|
index += 1;
|
|
@@ -472,14 +523,14 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
472
523
|
}
|
|
473
524
|
if (inlineValue !== undefined) {
|
|
474
525
|
if (!inlineValue) {
|
|
475
|
-
throw
|
|
526
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
476
527
|
}
|
|
477
528
|
flags[rawName] = inlineValue;
|
|
478
529
|
continue;
|
|
479
530
|
}
|
|
480
531
|
const next = argv[index + 1];
|
|
481
532
|
if (!next || next.startsWith("-")) {
|
|
482
|
-
throw
|
|
533
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
483
534
|
}
|
|
484
535
|
flags[rawName] = next;
|
|
485
536
|
index += 1;
|
|
@@ -511,65 +562,56 @@ function resolveCommandOptionValues(metadata, options) {
|
|
|
511
562
|
return resolved;
|
|
512
563
|
}
|
|
513
564
|
|
|
514
|
-
//
|
|
515
|
-
function
|
|
516
|
-
return
|
|
565
|
+
// src/cli-command-resolution.ts
|
|
566
|
+
function resolveEntrypointCliCommand(argv) {
|
|
567
|
+
return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
|
|
517
568
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
569
|
+
|
|
570
|
+
// src/cli-output-format.ts
|
|
571
|
+
var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
|
|
572
|
+
var LEGACY_CLI_OUTPUT_FORMAT_ALIASES = ["toon"];
|
|
573
|
+
var SUPPORTED_CLI_OUTPUT_FORMATS = [
|
|
574
|
+
...PUBLIC_CLI_OUTPUT_FORMATS,
|
|
575
|
+
...LEGACY_CLI_OUTPUT_FORMAT_ALIASES
|
|
576
|
+
];
|
|
577
|
+
var SUPPORTED_CLI_OUTPUT_FORMAT_VALUES = SUPPORTED_CLI_OUTPUT_FORMATS;
|
|
578
|
+
function formatSupportedCliOutputFormats() {
|
|
579
|
+
return PUBLIC_CLI_OUTPUT_FORMATS.join(", ");
|
|
580
|
+
}
|
|
581
|
+
function isSupportedCliOutputFormat(value) {
|
|
582
|
+
return typeof value === "string" && SUPPORTED_CLI_OUTPUT_FORMAT_VALUES.includes(value);
|
|
583
|
+
}
|
|
584
|
+
function normalizeCliOutputFormatArgv(argv) {
|
|
585
|
+
let normalized;
|
|
522
586
|
for (let index = 0;index < argv.length; index += 1) {
|
|
523
587
|
const arg = argv[index];
|
|
588
|
+
if (!arg) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
524
591
|
if (arg === "--") {
|
|
525
|
-
for (let restIndex = index + 1;restIndex < argv.length; restIndex += 1) {
|
|
526
|
-
positionalIndexes.push(restIndex);
|
|
527
|
-
}
|
|
528
592
|
break;
|
|
529
593
|
}
|
|
530
|
-
if (
|
|
531
|
-
positionalIndexes.push(index);
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
if (arg.startsWith("--")) {
|
|
535
|
-
if (arg.includes("=")) {
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
594
|
+
if (arg === "--format") {
|
|
538
595
|
const next = argv[index + 1];
|
|
539
|
-
if (
|
|
596
|
+
if (next === "text") {
|
|
597
|
+
normalized ??= [...argv];
|
|
598
|
+
normalized[index + 1] = "toon";
|
|
599
|
+
}
|
|
600
|
+
if (next && !next.startsWith("-")) {
|
|
540
601
|
index += 1;
|
|
541
602
|
}
|
|
542
603
|
continue;
|
|
543
604
|
}
|
|
544
|
-
if (arg
|
|
545
|
-
|
|
605
|
+
if (arg === "--format=text") {
|
|
606
|
+
normalized ??= [...argv];
|
|
607
|
+
normalized[index] = "--format=toon";
|
|
546
608
|
}
|
|
547
609
|
}
|
|
548
|
-
return
|
|
549
|
-
}
|
|
550
|
-
function findFirstPositionalIndex(argv, metadata) {
|
|
551
|
-
const positionalIndexes = collectPositionalIndexes(argv, metadata);
|
|
552
|
-
return positionalIndexes[0] ?? -1;
|
|
553
|
-
}
|
|
554
|
-
function findFirstPositional(argv, metadata) {
|
|
555
|
-
const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
|
|
556
|
-
return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
|
|
557
|
-
}
|
|
558
|
-
|
|
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);
|
|
610
|
+
return normalized ?? argv;
|
|
566
611
|
}
|
|
567
612
|
function formatInvalidCliOutputFormatMessage(value) {
|
|
568
613
|
return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
|
|
569
614
|
}
|
|
570
|
-
function resolveEntrypointCliCommand(argv) {
|
|
571
|
-
return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
|
|
572
|
-
}
|
|
573
615
|
function assertSupportedCliOutputFormat(value, argv) {
|
|
574
616
|
if (isSupportedCliOutputFormat(value)) {
|
|
575
617
|
return;
|
|
@@ -607,9 +649,6 @@ function validateCliOutputFormatArgv(argv) {
|
|
|
607
649
|
}
|
|
608
650
|
|
|
609
651
|
// src/cli-diagnostic-output.ts
|
|
610
|
-
function resolveEntrypointCliCommand2(argv) {
|
|
611
|
-
return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
|
|
612
|
-
}
|
|
613
652
|
function writeStructuredCliJsonToStderr(payload) {
|
|
614
653
|
process.stderr.write(`${JSON.stringify(payload, null, 2)}
|
|
615
654
|
`);
|
|
@@ -633,7 +672,10 @@ function prefersStructuredCliArgv(argv) {
|
|
|
633
672
|
return false;
|
|
634
673
|
}
|
|
635
674
|
function prefersStructuredCliOutput(args) {
|
|
636
|
-
|
|
675
|
+
if (args.formatExplicit) {
|
|
676
|
+
return args.format === "json" && isSupportedCliOutputFormat(args.format);
|
|
677
|
+
}
|
|
678
|
+
return Boolean(args.agent) || Boolean(args.context?.store?.isAIAgent);
|
|
637
679
|
}
|
|
638
680
|
function emitCliDiagnosticFailure(args, options) {
|
|
639
681
|
const diagnostic = createCliCommandError(options);
|
|
@@ -654,7 +696,7 @@ function writeStructuredCliDiagnosticError(argv, error) {
|
|
|
654
696
|
}
|
|
655
697
|
writeStructuredCliJsonToStderr({
|
|
656
698
|
error: serializeCliDiagnosticError(createCliCommandError({
|
|
657
|
-
command:
|
|
699
|
+
command: resolveEntrypointCliCommand(argv),
|
|
658
700
|
error
|
|
659
701
|
})),
|
|
660
702
|
ok: false
|
|
@@ -662,23 +704,6 @@ function writeStructuredCliDiagnosticError(argv, error) {
|
|
|
662
704
|
process.exitCode = 1;
|
|
663
705
|
return true;
|
|
664
706
|
}
|
|
665
|
-
|
|
666
|
-
// src/add-kind-ids.ts
|
|
667
|
-
var ADD_KIND_IDS = [
|
|
668
|
-
"admin-view",
|
|
669
|
-
"block",
|
|
670
|
-
"variation",
|
|
671
|
-
"style",
|
|
672
|
-
"transform",
|
|
673
|
-
"pattern",
|
|
674
|
-
"binding-source",
|
|
675
|
-
"rest-resource",
|
|
676
|
-
"ability",
|
|
677
|
-
"ai-feature",
|
|
678
|
-
"hooked-block",
|
|
679
|
-
"editor-plugin"
|
|
680
|
-
];
|
|
681
|
-
|
|
682
707
|
// src/command-registry.ts
|
|
683
708
|
var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
|
|
684
709
|
var WP_TYPIA_COMMAND_REGISTRY = [
|
|
@@ -827,6 +852,78 @@ var WP_TYPIA_CONFIG_SOURCES = [
|
|
|
827
852
|
".wp-typiarc",
|
|
828
853
|
".wp-typiarc.json"
|
|
829
854
|
];
|
|
855
|
+
var wpTypiaSchemaSourceSchema = exports_external.object({
|
|
856
|
+
namespace: exports_external.string(),
|
|
857
|
+
path: exports_external.string()
|
|
858
|
+
}).strict();
|
|
859
|
+
var createConfigSchema = exports_external.object({
|
|
860
|
+
"alternate-render-targets": exports_external.string().optional(),
|
|
861
|
+
"inner-blocks-preset": exports_external.string().optional(),
|
|
862
|
+
"data-storage": exports_external.string().optional(),
|
|
863
|
+
"dry-run": exports_external.boolean().optional(),
|
|
864
|
+
"external-layer-id": exports_external.string().optional(),
|
|
865
|
+
"external-layer-source": exports_external.string().optional(),
|
|
866
|
+
namespace: exports_external.string().optional(),
|
|
867
|
+
"no-install": exports_external.boolean().optional(),
|
|
868
|
+
"package-manager": exports_external.string().optional(),
|
|
869
|
+
"persistence-policy": exports_external.string().optional(),
|
|
870
|
+
"php-prefix": exports_external.string().optional(),
|
|
871
|
+
"query-post-type": exports_external.string().optional(),
|
|
872
|
+
template: exports_external.string().optional(),
|
|
873
|
+
"text-domain": exports_external.string().optional(),
|
|
874
|
+
variant: exports_external.string().optional(),
|
|
875
|
+
"with-migration-ui": exports_external.boolean().optional(),
|
|
876
|
+
"with-test-preset": exports_external.boolean().optional(),
|
|
877
|
+
"with-wp-env": exports_external.boolean().optional(),
|
|
878
|
+
yes: exports_external.boolean().optional()
|
|
879
|
+
}).strict();
|
|
880
|
+
var addBlockConfigSchema = exports_external.object({
|
|
881
|
+
"alternate-render-targets": exports_external.string().optional(),
|
|
882
|
+
"data-storage": exports_external.string().optional(),
|
|
883
|
+
"external-layer-id": exports_external.string().optional(),
|
|
884
|
+
"external-layer-source": exports_external.string().optional(),
|
|
885
|
+
"inner-blocks-preset": exports_external.string().optional(),
|
|
886
|
+
"persistence-policy": exports_external.string().optional(),
|
|
887
|
+
template: exports_external.string().optional()
|
|
888
|
+
}).strict();
|
|
889
|
+
var addConfigSchema = exports_external.object({
|
|
890
|
+
block: addBlockConfigSchema.optional()
|
|
891
|
+
}).strict();
|
|
892
|
+
var mcpConfigSchema = exports_external.object({
|
|
893
|
+
schemaSources: exports_external.array(wpTypiaSchemaSourceSchema).optional()
|
|
894
|
+
}).strict();
|
|
895
|
+
var wpTypiaUserConfigSchema = exports_external.object({
|
|
896
|
+
add: addConfigSchema.optional(),
|
|
897
|
+
create: createConfigSchema.optional(),
|
|
898
|
+
mcp: mcpConfigSchema.optional()
|
|
899
|
+
}).strict();
|
|
900
|
+
function formatIssuePath(issuePath) {
|
|
901
|
+
if (issuePath.length === 0) {
|
|
902
|
+
return "config";
|
|
903
|
+
}
|
|
904
|
+
return issuePath.map((segment) => typeof segment === "number" ? `[${segment}]` : `.${String(segment)}`).join("").replace(/^\./u, "");
|
|
905
|
+
}
|
|
906
|
+
function formatConfigValidationIssue(issue) {
|
|
907
|
+
const pathLabel = formatIssuePath(issue.path);
|
|
908
|
+
if (issue.code === "unrecognized_keys") {
|
|
909
|
+
const keys = issue.keys.map((key) => `"${String(key)}"`).join(", ");
|
|
910
|
+
const label = issue.keys.length === 1 ? "unknown key" : "unknown keys";
|
|
911
|
+
return `${pathLabel}: ${label} ${keys}. Unknown keys are errors in wp-typia config.`;
|
|
912
|
+
}
|
|
913
|
+
return `${pathLabel}: ${issue.message}`;
|
|
914
|
+
}
|
|
915
|
+
function validateWpTypiaUserConfig(value, source) {
|
|
916
|
+
const result = wpTypiaUserConfigSchema.safeParse(value);
|
|
917
|
+
if (result.success) {
|
|
918
|
+
return result.data;
|
|
919
|
+
}
|
|
920
|
+
const issueLines = result.error.issues.map(formatConfigValidationIssue);
|
|
921
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, [
|
|
922
|
+
`Invalid wp-typia config at ${source}.`,
|
|
923
|
+
...issueLines.map((line) => `- ${line}`)
|
|
924
|
+
].join(`
|
|
925
|
+
`));
|
|
926
|
+
}
|
|
830
927
|
function deepMerge(base, incoming) {
|
|
831
928
|
const merged = { ...base };
|
|
832
929
|
for (const [key, value] of Object.entries(incoming)) {
|
|
@@ -848,18 +945,21 @@ async function readJsonFile(filePath) {
|
|
|
848
945
|
source = await fs.readFile(filePath, "utf8");
|
|
849
946
|
} catch (error) {
|
|
850
947
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
851
|
-
return
|
|
948
|
+
return;
|
|
852
949
|
}
|
|
853
950
|
throw error;
|
|
854
951
|
}
|
|
855
952
|
try {
|
|
856
|
-
|
|
857
|
-
return isRecord(parsed) ? parsed : null;
|
|
953
|
+
return JSON.parse(source);
|
|
858
954
|
} catch (error) {
|
|
859
955
|
const message = error instanceof Error ? error.message : String(error);
|
|
860
956
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
861
957
|
}
|
|
862
958
|
}
|
|
959
|
+
async function readWpTypiaConfigFile(filePath) {
|
|
960
|
+
const parsed = await readJsonFile(filePath);
|
|
961
|
+
return parsed === undefined ? null : validateWpTypiaUserConfig(parsed, filePath);
|
|
962
|
+
}
|
|
863
963
|
function resolveConfigPath(cwd, source) {
|
|
864
964
|
if (source.startsWith("~/")) {
|
|
865
965
|
return path.join(os.homedir(), source.slice(2));
|
|
@@ -870,21 +970,23 @@ function mergeWpTypiaUserConfig(base, incoming) {
|
|
|
870
970
|
return deepMerge(base, incoming);
|
|
871
971
|
}
|
|
872
972
|
async function loadWpTypiaUserConfigFromSource(cwd, source) {
|
|
873
|
-
const config = await
|
|
973
|
+
const config = await readWpTypiaConfigFile(resolveConfigPath(cwd, source));
|
|
874
974
|
return config ?? {};
|
|
875
975
|
}
|
|
876
976
|
async function loadWpTypiaUserConfig(cwd) {
|
|
877
977
|
let merged = {};
|
|
878
978
|
for (const source of WP_TYPIA_CONFIG_SOURCES) {
|
|
879
979
|
const configPath = resolveConfigPath(cwd, source);
|
|
880
|
-
const config = await
|
|
980
|
+
const config = await readWpTypiaConfigFile(configPath);
|
|
881
981
|
if (config) {
|
|
882
982
|
merged = deepMerge(merged, config);
|
|
883
983
|
}
|
|
884
984
|
}
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
985
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
986
|
+
const packageJson = await readJsonFile(packageJsonPath);
|
|
987
|
+
if (isRecord(packageJson) && "wp-typia" in packageJson) {
|
|
988
|
+
const packageConfig = validateWpTypiaUserConfig(packageJson["wp-typia"], `${packageJsonPath}#wp-typia`);
|
|
989
|
+
merged = deepMerge(merged, packageConfig);
|
|
888
990
|
}
|
|
889
991
|
return merged;
|
|
890
992
|
}
|
|
@@ -902,6 +1004,6 @@ function getMcpSchemaSources(config) {
|
|
|
902
1004
|
function createPlugin(input) {
|
|
903
1005
|
return input;
|
|
904
1006
|
}
|
|
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,
|
|
1007
|
+
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, createMissingOptionValueError, extractKnownOptionValuesFromArgv, resolveCommandOptionValues, normalizeCliOutputFormatArgv, validateCliOutputFormatArgv, prefersStructuredCliOutput, emitCliDiagnosticFailure, writeStructuredCliDiagnosticError, 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 };
|
|
906
1008
|
|
|
907
|
-
//# debugId=
|
|
1009
|
+
//# debugId=B47B1FB40378942764756E2164756E21
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// ../wp-typia-project-tools/src/runtime/cli-add-kind-ids.ts
|
|
3
|
+
var ADD_KIND_IDS = [
|
|
4
|
+
"admin-view",
|
|
5
|
+
"block",
|
|
6
|
+
"variation",
|
|
7
|
+
"style",
|
|
8
|
+
"transform",
|
|
9
|
+
"pattern",
|
|
10
|
+
"binding-source",
|
|
11
|
+
"rest-resource",
|
|
12
|
+
"ability",
|
|
13
|
+
"ai-feature",
|
|
14
|
+
"hooked-block",
|
|
15
|
+
"editor-plugin"
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export { ADD_KIND_IDS };
|
|
19
|
+
|
|
20
|
+
//# debugId=B2A14CEE6DB922C564756E2164756E21
|