wp-typia 0.22.5 → 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 +1820 -1020
- package/dist-bunli/{cli-xbzfx7qz.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-j30rk466.js → cli-5kn2p7ee.js} +693 -259
- package/dist-bunli/{cli-ctddkm3n.js → cli-6a65qfb1.js} +475 -249
- package/dist-bunli/{cli-add-1gqgshf0.js → cli-add-5vmxpgmn.js} +84 -62
- package/dist-bunli/{cli-doctor-w35s8y9w.js → cli-doctor-ngzs8kkc.js} +15 -18
- package/dist-bunli/{cli-nzwpmw4y.js → cli-f44sphgv.js} +98 -32
- package/dist-bunli/cli-fys8vm2t.js +20 -0
- package/dist-bunli/{cli-btbpt84c.js → cli-hhp1d348.js} +1 -1
- package/dist-bunli/{cli-init-z8sjmkvc.js → cli-init-df1wg71p.js} +421 -401
- package/dist-bunli/{cli-scaffold-ad3bd555.js → cli-scaffold-btx3wfsn.js} +8 -7
- package/dist-bunli/cli.js +8 -6
- package/dist-bunli/{command-list-scd6zqp8.js → command-list-bqr2tp8w.js} +16 -12
- package/dist-bunli/{migrations-skkzdvhm.js → migrations-bnrjw4k1.js} +7 -6
- package/dist-bunli/node-cli.js +253 -97
- package/dist-bunli/{workspace-project-7826tewa.js → workspace-project-csnnggz6.js} +2 -2
- package/package.json +2 -2
|
@@ -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",
|
|
@@ -467,6 +470,9 @@ function buildArgvWalkerRoutingMetadata(...metadataMaps) {
|
|
|
467
470
|
};
|
|
468
471
|
}
|
|
469
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
|
+
}
|
|
470
476
|
function extractKnownOptionValuesFromArgv(argv, options) {
|
|
471
477
|
const flags = {};
|
|
472
478
|
const nextArgv = [];
|
|
@@ -492,7 +498,7 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
492
498
|
}
|
|
493
499
|
const next = argv[index + 1];
|
|
494
500
|
if (!next || next.startsWith("-")) {
|
|
495
|
-
throw
|
|
501
|
+
throw createMissingOptionValueError(arg);
|
|
496
502
|
}
|
|
497
503
|
flags[shortFlag.name] = next;
|
|
498
504
|
index += 1;
|
|
@@ -517,14 +523,14 @@ function extractKnownOptionValuesFromArgv(argv, options) {
|
|
|
517
523
|
}
|
|
518
524
|
if (inlineValue !== undefined) {
|
|
519
525
|
if (!inlineValue) {
|
|
520
|
-
throw
|
|
526
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
521
527
|
}
|
|
522
528
|
flags[rawName] = inlineValue;
|
|
523
529
|
continue;
|
|
524
530
|
}
|
|
525
531
|
const next = argv[index + 1];
|
|
526
532
|
if (!next || next.startsWith("-")) {
|
|
527
|
-
throw
|
|
533
|
+
throw createMissingOptionValueError(`--${rawName}`);
|
|
528
534
|
}
|
|
529
535
|
flags[rawName] = next;
|
|
530
536
|
index += 1;
|
|
@@ -698,23 +704,6 @@ function writeStructuredCliDiagnosticError(argv, error) {
|
|
|
698
704
|
process.exitCode = 1;
|
|
699
705
|
return true;
|
|
700
706
|
}
|
|
701
|
-
|
|
702
|
-
// src/add-kind-ids.ts
|
|
703
|
-
var ADD_KIND_IDS = [
|
|
704
|
-
"admin-view",
|
|
705
|
-
"block",
|
|
706
|
-
"variation",
|
|
707
|
-
"style",
|
|
708
|
-
"transform",
|
|
709
|
-
"pattern",
|
|
710
|
-
"binding-source",
|
|
711
|
-
"rest-resource",
|
|
712
|
-
"ability",
|
|
713
|
-
"ai-feature",
|
|
714
|
-
"hooked-block",
|
|
715
|
-
"editor-plugin"
|
|
716
|
-
];
|
|
717
|
-
|
|
718
707
|
// src/command-registry.ts
|
|
719
708
|
var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
|
|
720
709
|
var WP_TYPIA_COMMAND_REGISTRY = [
|
|
@@ -863,6 +852,78 @@ var WP_TYPIA_CONFIG_SOURCES = [
|
|
|
863
852
|
".wp-typiarc",
|
|
864
853
|
".wp-typiarc.json"
|
|
865
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
|
+
}
|
|
866
927
|
function deepMerge(base, incoming) {
|
|
867
928
|
const merged = { ...base };
|
|
868
929
|
for (const [key, value] of Object.entries(incoming)) {
|
|
@@ -884,18 +945,21 @@ async function readJsonFile(filePath) {
|
|
|
884
945
|
source = await fs.readFile(filePath, "utf8");
|
|
885
946
|
} catch (error) {
|
|
886
947
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
887
|
-
return
|
|
948
|
+
return;
|
|
888
949
|
}
|
|
889
950
|
throw error;
|
|
890
951
|
}
|
|
891
952
|
try {
|
|
892
|
-
|
|
893
|
-
return isRecord(parsed) ? parsed : null;
|
|
953
|
+
return JSON.parse(source);
|
|
894
954
|
} catch (error) {
|
|
895
955
|
const message = error instanceof Error ? error.message : String(error);
|
|
896
956
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
897
957
|
}
|
|
898
958
|
}
|
|
959
|
+
async function readWpTypiaConfigFile(filePath) {
|
|
960
|
+
const parsed = await readJsonFile(filePath);
|
|
961
|
+
return parsed === undefined ? null : validateWpTypiaUserConfig(parsed, filePath);
|
|
962
|
+
}
|
|
899
963
|
function resolveConfigPath(cwd, source) {
|
|
900
964
|
if (source.startsWith("~/")) {
|
|
901
965
|
return path.join(os.homedir(), source.slice(2));
|
|
@@ -906,21 +970,23 @@ function mergeWpTypiaUserConfig(base, incoming) {
|
|
|
906
970
|
return deepMerge(base, incoming);
|
|
907
971
|
}
|
|
908
972
|
async function loadWpTypiaUserConfigFromSource(cwd, source) {
|
|
909
|
-
const config = await
|
|
973
|
+
const config = await readWpTypiaConfigFile(resolveConfigPath(cwd, source));
|
|
910
974
|
return config ?? {};
|
|
911
975
|
}
|
|
912
976
|
async function loadWpTypiaUserConfig(cwd) {
|
|
913
977
|
let merged = {};
|
|
914
978
|
for (const source of WP_TYPIA_CONFIG_SOURCES) {
|
|
915
979
|
const configPath = resolveConfigPath(cwd, source);
|
|
916
|
-
const config = await
|
|
980
|
+
const config = await readWpTypiaConfigFile(configPath);
|
|
917
981
|
if (config) {
|
|
918
982
|
merged = deepMerge(merged, config);
|
|
919
983
|
}
|
|
920
984
|
}
|
|
921
|
-
const
|
|
922
|
-
|
|
923
|
-
|
|
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);
|
|
924
990
|
}
|
|
925
991
|
return merged;
|
|
926
992
|
}
|
|
@@ -938,6 +1004,6 @@ function getMcpSchemaSources(config) {
|
|
|
938
1004
|
function createPlugin(input) {
|
|
939
1005
|
return input;
|
|
940
1006
|
}
|
|
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,
|
|
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 };
|
|
942
1008
|
|
|
943
|
-
//# 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
|