wp-typia 0.24.5 → 0.24.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 +3 -3
- package/dist/cli.js +212 -145
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Configuration files:
|
|
|
49
49
|
Compatibility notes:
|
|
50
50
|
|
|
51
51
|
- `@wp-typia/project-tools` is the canonical programmatic project orchestration package
|
|
52
|
-
- the published CLI ships a built `dist` runtime, and the canonical Node bin supports `create`, `add`, `migrate`, `doctor`, `sync`, `skills`, `
|
|
52
|
+
- the published CLI ships a built `dist` runtime, and the canonical Node bin supports `create`, `add`, `migrate`, `doctor`, `sync`, `skills`, `complete`, the legacy `completions` alias, `mcp`, `--version`, `--help`, and template inspection without requiring a locally installed Bun binary
|
|
53
53
|
- Bun remains supported for repository development, tests, and builds, while Node is the canonical npm runtime for the published CLI
|
|
54
54
|
- when you request machine-readable output with `--format json`, CLI failures now include a stable `error.code` field so wrappers and CI can branch without parsing English text
|
|
55
55
|
- the stable machine-handled branching key is `error.code`. Structured context like `error.command`, `error.kind`, and `error.tag` may also be useful to consumers, while free-form text like `error.message`, `error.summary`, and `error.detailLines` stays human-facing guidance and can evolve without notice
|
|
@@ -57,8 +57,8 @@ Compatibility notes:
|
|
|
57
57
|
- internal runtime-bridge helper modules are implementation details; integrations
|
|
58
58
|
should target the CLI or `@wp-typia/project-tools`, not CLI internals
|
|
59
59
|
|
|
60
|
-
Maintainers: see [`docs/
|
|
61
|
-
for
|
|
60
|
+
Maintainers: see [`docs/gunshi-runtime-contract.md`](https://imjlk.github.io/wp-typia/maintainers/gunshi-runtime-contract/)
|
|
61
|
+
for the Gunshi runtime contract.
|
|
62
62
|
|
|
63
63
|
Project meta docs:
|
|
64
64
|
|
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ var package_default;
|
|
|
21
21
|
var init_package = __esm(() => {
|
|
22
22
|
package_default = {
|
|
23
23
|
name: "wp-typia",
|
|
24
|
-
version: "0.24.
|
|
24
|
+
version: "0.24.6",
|
|
25
25
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
26
26
|
packageManager: "bun@1.3.11",
|
|
27
27
|
type: "module",
|
|
@@ -77,7 +77,7 @@ var init_package = __esm(() => {
|
|
|
77
77
|
dependencies: {
|
|
78
78
|
"@gunshi/plugin-completion": "0.32.0",
|
|
79
79
|
"@wp-typia/api-client": "^0.4.6",
|
|
80
|
-
"@wp-typia/project-tools": "0.24.
|
|
80
|
+
"@wp-typia/project-tools": "0.24.6",
|
|
81
81
|
gunshi: "0.32.0",
|
|
82
82
|
zod: "4.3.6"
|
|
83
83
|
},
|
|
@@ -1315,7 +1315,7 @@ var init_pattern = __esm(() => {
|
|
|
1315
1315
|
},
|
|
1316
1316
|
sortOrder: 60,
|
|
1317
1317
|
supportsDryRun: true,
|
|
1318
|
-
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--
|
|
1318
|
+
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--thumbnail-url <url>] [--dry-run]",
|
|
1319
1319
|
visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
|
|
1320
1320
|
});
|
|
1321
1321
|
});
|
|
@@ -2745,22 +2745,22 @@ var init_runtime_bridge = __esm(() => {
|
|
|
2745
2745
|
init_runtime_bridge_sync();
|
|
2746
2746
|
});
|
|
2747
2747
|
|
|
2748
|
-
// src/
|
|
2748
|
+
// src/portable-cli/dispatchers/add.ts
|
|
2749
2749
|
var exports_add = {};
|
|
2750
2750
|
__export(exports_add, {
|
|
2751
|
-
|
|
2751
|
+
dispatchPortableCliAdd: () => dispatchPortableCliAdd
|
|
2752
2752
|
});
|
|
2753
2753
|
import {
|
|
2754
2754
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES18,
|
|
2755
2755
|
createCliCommandError as createCliCommandError6
|
|
2756
2756
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2757
|
-
function
|
|
2757
|
+
function resolvePortableCliAddName(positionals) {
|
|
2758
2758
|
if (positionals[1] === "core-variation" && positionals[3]) {
|
|
2759
2759
|
return positionals[3];
|
|
2760
2760
|
}
|
|
2761
2761
|
return positionals[2];
|
|
2762
2762
|
}
|
|
2763
|
-
async function
|
|
2763
|
+
async function dispatchPortableCliAdd({
|
|
2764
2764
|
cwd,
|
|
2765
2765
|
mergedFlags,
|
|
2766
2766
|
positionals,
|
|
@@ -2779,7 +2779,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
2779
2779
|
});
|
|
2780
2780
|
}
|
|
2781
2781
|
const kind = positionals[1];
|
|
2782
|
-
const name =
|
|
2782
|
+
const name = resolvePortableCliAddName(positionals);
|
|
2783
2783
|
const positionalArgs = positionals.slice(1);
|
|
2784
2784
|
if (mergedFlags.format === "json") {
|
|
2785
2785
|
let completion;
|
|
@@ -2826,16 +2826,16 @@ var init_add2 = __esm(() => {
|
|
|
2826
2826
|
init_runtime_bridge_output();
|
|
2827
2827
|
});
|
|
2828
2828
|
|
|
2829
|
-
// src/
|
|
2829
|
+
// src/portable-cli/dispatchers/create.ts
|
|
2830
2830
|
var exports_create = {};
|
|
2831
2831
|
__export(exports_create, {
|
|
2832
|
-
|
|
2832
|
+
dispatchPortableCliCreate: () => dispatchPortableCliCreate
|
|
2833
2833
|
});
|
|
2834
2834
|
import {
|
|
2835
2835
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES19,
|
|
2836
2836
|
createCliCommandError as createCliCommandError7
|
|
2837
2837
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2838
|
-
async function
|
|
2838
|
+
async function dispatchPortableCliCreate({
|
|
2839
2839
|
cwd,
|
|
2840
2840
|
mergedFlags,
|
|
2841
2841
|
positionals,
|
|
@@ -2881,16 +2881,16 @@ var init_create2 = __esm(() => {
|
|
|
2881
2881
|
init_cli_error_messages();
|
|
2882
2882
|
});
|
|
2883
2883
|
|
|
2884
|
-
// src/
|
|
2884
|
+
// src/portable-cli/doctor.ts
|
|
2885
2885
|
var exports_doctor = {};
|
|
2886
2886
|
__export(exports_doctor, {
|
|
2887
|
-
|
|
2887
|
+
dispatchPortableCliDoctor: () => dispatchPortableCliDoctor
|
|
2888
2888
|
});
|
|
2889
2889
|
import {
|
|
2890
2890
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES20,
|
|
2891
2891
|
createCliCommandError as createCliCommandError8
|
|
2892
2892
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
2893
|
-
async function
|
|
2893
|
+
async function renderPortableCliDoctorJson(cwd, exitPolicy, printLine) {
|
|
2894
2894
|
const {
|
|
2895
2895
|
createDoctorRunSummary,
|
|
2896
2896
|
getDoctorChecks,
|
|
@@ -2911,14 +2911,14 @@ async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
|
2911
2911
|
});
|
|
2912
2912
|
}
|
|
2913
2913
|
}
|
|
2914
|
-
async function
|
|
2914
|
+
async function dispatchPortableCliDoctor({
|
|
2915
2915
|
cwd,
|
|
2916
2916
|
mergedFlags,
|
|
2917
2917
|
printLine
|
|
2918
2918
|
}) {
|
|
2919
2919
|
const exitPolicy = mergedFlags["workspace-only"] ? "workspace-only" : "strict";
|
|
2920
2920
|
if (mergedFlags.format === "json") {
|
|
2921
|
-
await
|
|
2921
|
+
await renderPortableCliDoctorJson(cwd, exitPolicy, printLine);
|
|
2922
2922
|
return;
|
|
2923
2923
|
}
|
|
2924
2924
|
await executeDoctorCommand(cwd, { exitPolicy });
|
|
@@ -2927,10 +2927,10 @@ var init_doctor = __esm(() => {
|
|
|
2927
2927
|
init_runtime_bridge();
|
|
2928
2928
|
});
|
|
2929
2929
|
|
|
2930
|
-
// src/
|
|
2930
|
+
// src/portable-cli/templates.ts
|
|
2931
2931
|
var exports_templates = {};
|
|
2932
2932
|
__export(exports_templates, {
|
|
2933
|
-
|
|
2933
|
+
dispatchPortableCliTemplates: () => dispatchPortableCliTemplates
|
|
2934
2934
|
});
|
|
2935
2935
|
import {
|
|
2936
2936
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES21,
|
|
@@ -2940,7 +2940,7 @@ import {
|
|
|
2940
2940
|
getTemplateById,
|
|
2941
2941
|
listTemplates
|
|
2942
2942
|
} from "@wp-typia/project-tools/cli-templates";
|
|
2943
|
-
function
|
|
2943
|
+
function renderPortableCliTemplatesJson(printLine, flags, subcommand) {
|
|
2944
2944
|
if (subcommand === "list") {
|
|
2945
2945
|
printLine(JSON.stringify({
|
|
2946
2946
|
templates: listTemplates()
|
|
@@ -2967,7 +2967,7 @@ function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
|
2967
2967
|
template
|
|
2968
2968
|
}, null, 2));
|
|
2969
2969
|
}
|
|
2970
|
-
async function
|
|
2970
|
+
async function dispatchPortableCliTemplates({
|
|
2971
2971
|
mergedFlags,
|
|
2972
2972
|
positionals,
|
|
2973
2973
|
printLine
|
|
@@ -2985,7 +2985,7 @@ async function dispatchNodeFallbackTemplates({
|
|
|
2985
2985
|
});
|
|
2986
2986
|
}
|
|
2987
2987
|
if (mergedFlags.format === "json") {
|
|
2988
|
-
|
|
2988
|
+
renderPortableCliTemplatesJson(printLine, {
|
|
2989
2989
|
format: mergedFlags.format,
|
|
2990
2990
|
id: templateId
|
|
2991
2991
|
}, resolvedSubcommand);
|
|
@@ -3020,21 +3020,21 @@ var WP_TYPIA_COMMAND_REGISTRY = [
|
|
|
3020
3020
|
commandTree: true,
|
|
3021
3021
|
description: "Scaffold a new wp-typia project.",
|
|
3022
3022
|
name: "create",
|
|
3023
|
-
|
|
3023
|
+
portableCli: true,
|
|
3024
3024
|
optionGroups: ["create"]
|
|
3025
3025
|
},
|
|
3026
3026
|
{
|
|
3027
3027
|
commandTree: true,
|
|
3028
3028
|
description: "Preview or apply the minimum retrofit plan for an existing project.",
|
|
3029
3029
|
name: "init",
|
|
3030
|
-
|
|
3030
|
+
portableCli: true,
|
|
3031
3031
|
optionGroups: ["init"]
|
|
3032
3032
|
},
|
|
3033
3033
|
{
|
|
3034
3034
|
commandTree: true,
|
|
3035
3035
|
description: "Run the common generated-project sync workflow.",
|
|
3036
3036
|
name: "sync",
|
|
3037
|
-
|
|
3037
|
+
portableCli: true,
|
|
3038
3038
|
optionGroups: ["sync"],
|
|
3039
3039
|
subcommands: ["ai"]
|
|
3040
3040
|
},
|
|
@@ -3042,7 +3042,7 @@ var WP_TYPIA_COMMAND_REGISTRY = [
|
|
|
3042
3042
|
commandTree: true,
|
|
3043
3043
|
description: "Extend an official wp-typia workspace.",
|
|
3044
3044
|
name: "add",
|
|
3045
|
-
|
|
3045
|
+
portableCli: true,
|
|
3046
3046
|
optionGroups: ["add"],
|
|
3047
3047
|
subcommands: ADD_KIND_IDS2
|
|
3048
3048
|
},
|
|
@@ -3050,7 +3050,7 @@ var WP_TYPIA_COMMAND_REGISTRY = [
|
|
|
3050
3050
|
commandTree: true,
|
|
3051
3051
|
description: "Run migration workflows.",
|
|
3052
3052
|
name: "migrate",
|
|
3053
|
-
|
|
3053
|
+
portableCli: true,
|
|
3054
3054
|
optionGroups: ["migrate"],
|
|
3055
3055
|
subcommands: [
|
|
3056
3056
|
"init",
|
|
@@ -3069,7 +3069,7 @@ var WP_TYPIA_COMMAND_REGISTRY = [
|
|
|
3069
3069
|
commandTree: true,
|
|
3070
3070
|
description: "Inspect scaffold templates.",
|
|
3071
3071
|
name: "templates",
|
|
3072
|
-
|
|
3072
|
+
portableCli: true,
|
|
3073
3073
|
optionGroups: ["templates"],
|
|
3074
3074
|
subcommands: ["list", "inspect"]
|
|
3075
3075
|
},
|
|
@@ -3077,51 +3077,51 @@ var WP_TYPIA_COMMAND_REGISTRY = [
|
|
|
3077
3077
|
commandTree: true,
|
|
3078
3078
|
description: "Run repository and project diagnostics.",
|
|
3079
3079
|
name: "doctor",
|
|
3080
|
-
|
|
3080
|
+
portableCli: true,
|
|
3081
3081
|
optionGroups: ["doctor"]
|
|
3082
3082
|
},
|
|
3083
3083
|
{
|
|
3084
3084
|
commandTree: true,
|
|
3085
3085
|
description: "Inspect or sync schema-driven MCP metadata.",
|
|
3086
3086
|
name: "mcp",
|
|
3087
|
-
|
|
3087
|
+
portableCli: true,
|
|
3088
3088
|
optionGroups: ["mcp"],
|
|
3089
3089
|
subcommands: ["list", "sync"]
|
|
3090
3090
|
},
|
|
3091
3091
|
{
|
|
3092
3092
|
commandTree: false,
|
|
3093
3093
|
name: "help",
|
|
3094
|
-
|
|
3094
|
+
portableCli: true,
|
|
3095
3095
|
optionGroups: []
|
|
3096
3096
|
},
|
|
3097
3097
|
{
|
|
3098
3098
|
commandTree: false,
|
|
3099
3099
|
name: "version",
|
|
3100
|
-
|
|
3100
|
+
portableCli: true,
|
|
3101
3101
|
optionGroups: []
|
|
3102
3102
|
},
|
|
3103
3103
|
{
|
|
3104
3104
|
commandTree: false,
|
|
3105
3105
|
name: "skills",
|
|
3106
|
-
|
|
3106
|
+
portableCli: true,
|
|
3107
3107
|
optionGroups: ["skills"],
|
|
3108
3108
|
subcommands: ["list", "sync"]
|
|
3109
3109
|
},
|
|
3110
3110
|
{
|
|
3111
3111
|
commandTree: false,
|
|
3112
3112
|
name: "completions",
|
|
3113
|
-
|
|
3113
|
+
portableCli: true,
|
|
3114
3114
|
optionGroups: []
|
|
3115
3115
|
},
|
|
3116
3116
|
{
|
|
3117
3117
|
commandTree: false,
|
|
3118
3118
|
name: "complete",
|
|
3119
|
-
|
|
3119
|
+
portableCli: true,
|
|
3120
3120
|
optionGroups: []
|
|
3121
3121
|
}
|
|
3122
3122
|
];
|
|
3123
3123
|
var WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES = WP_TYPIA_COMMAND_REGISTRY.map((command) => command.name);
|
|
3124
|
-
var
|
|
3124
|
+
var WP_TYPIA_PORTABLE_CLI_TOP_LEVEL_COMMAND_NAMES = WP_TYPIA_COMMAND_REGISTRY.filter((command) => command.portableCli).map((command) => command.name);
|
|
3125
3125
|
var WP_TYPIA_TOP_LEVEL_COMMAND_NAMES = WP_TYPIA_COMMAND_REGISTRY.filter((command) => command.commandTree).map((command) => command.name);
|
|
3126
3126
|
var WP_TYPIA_FUTURE_COMMAND_TREE = WP_TYPIA_COMMAND_REGISTRY.filter((command) => command.commandTree).map((command) => ({
|
|
3127
3127
|
description: command.description,
|
|
@@ -3134,7 +3134,7 @@ for (const command of WP_TYPIA_COMMAND_REGISTRY) {
|
|
|
3134
3134
|
}
|
|
3135
3135
|
var WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND = commandOptionGroupNamesByTopLevelCommand;
|
|
3136
3136
|
|
|
3137
|
-
// src/
|
|
3137
|
+
// src/portable-cli/errors.ts
|
|
3138
3138
|
import {
|
|
3139
3139
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
|
|
3140
3140
|
createCliCommandError as createCliCommandError3,
|
|
@@ -3245,7 +3245,6 @@ function findFirstPositional(argv, metadata) {
|
|
|
3245
3245
|
}
|
|
3246
3246
|
|
|
3247
3247
|
// src/command-option-metadata.ts
|
|
3248
|
-
import { z } from "zod";
|
|
3249
3248
|
import {
|
|
3250
3249
|
CLI_DIAGNOSTIC_CODES,
|
|
3251
3250
|
createCliDiagnosticCodeError
|
|
@@ -3271,6 +3270,7 @@ var ADD_OPTION_METADATA = {
|
|
|
3271
3270
|
},
|
|
3272
3271
|
block: {
|
|
3273
3272
|
description: "Target block slug/name for variation, core-variation, style, and end-to-end binding-source workflows.",
|
|
3273
|
+
short: "b",
|
|
3274
3274
|
type: "string"
|
|
3275
3275
|
},
|
|
3276
3276
|
"catalog-title": {
|
|
@@ -3292,6 +3292,7 @@ var ADD_OPTION_METADATA = {
|
|
|
3292
3292
|
"dry-run": {
|
|
3293
3293
|
argumentKind: "flag",
|
|
3294
3294
|
description: "Preview workspace file updates and completion guidance without writing them.",
|
|
3295
|
+
short: "d",
|
|
3295
3296
|
type: "boolean"
|
|
3296
3297
|
},
|
|
3297
3298
|
"external-layer-id": {
|
|
@@ -3342,6 +3343,7 @@ var ADD_OPTION_METADATA = {
|
|
|
3342
3343
|
},
|
|
3343
3344
|
namespace: {
|
|
3344
3345
|
description: "REST namespace for rest-resource and ai-feature workflows.",
|
|
3346
|
+
short: "n",
|
|
3345
3347
|
type: "string"
|
|
3346
3348
|
},
|
|
3347
3349
|
"permission-callback": {
|
|
@@ -3427,6 +3429,7 @@ var ADD_OPTION_METADATA = {
|
|
|
3427
3429
|
},
|
|
3428
3430
|
template: {
|
|
3429
3431
|
description: "Optional built-in block family for the new block; interactive flows let you choose it when omitted and non-interactive runs default to basic.",
|
|
3432
|
+
short: "t",
|
|
3430
3433
|
type: "string"
|
|
3431
3434
|
},
|
|
3432
3435
|
"thumbnail-url": {
|
|
@@ -3434,12 +3437,13 @@ var ADD_OPTION_METADATA = {
|
|
|
3434
3437
|
type: "string"
|
|
3435
3438
|
},
|
|
3436
3439
|
tags: {
|
|
3437
|
-
description: "Comma-separated tags for typed pattern catalog entries
|
|
3440
|
+
description: "Comma-separated tags for typed pattern catalog entries.",
|
|
3438
3441
|
repeatable: true,
|
|
3439
3442
|
type: "string"
|
|
3440
3443
|
},
|
|
3441
3444
|
tag: {
|
|
3442
|
-
description: "
|
|
3445
|
+
description: "Legacy repeatable single-tag alias for typed pattern catalog entries; prefer --tags.",
|
|
3446
|
+
hidden: true,
|
|
3443
3447
|
repeatable: true,
|
|
3444
3448
|
type: "string"
|
|
3445
3449
|
},
|
|
@@ -3707,8 +3711,8 @@ var ALL_COMMAND_OPTION_METADATA = collectCommandOptionMetadata(...COMMAND_OPTION
|
|
|
3707
3711
|
function collectOptionNamesByType(metadata, type) {
|
|
3708
3712
|
return Object.entries(metadata).filter(([, option]) => option.type === type).map(([name]) => name);
|
|
3709
3713
|
}
|
|
3710
|
-
function
|
|
3711
|
-
return Object.entries(metadata).map(([name, option]) => {
|
|
3714
|
+
function formatPortableCliOptionHelp(metadata) {
|
|
3715
|
+
return Object.entries(metadata).filter(([, option]) => !option.hidden).map(([name, option]) => {
|
|
3712
3716
|
const short = option.short ? `, -${option.short}` : "";
|
|
3713
3717
|
return `- --${name}${short}: ${option.description}`;
|
|
3714
3718
|
});
|
|
@@ -4066,6 +4070,59 @@ function hasUnknownOptionBefore(argv, endIndex) {
|
|
|
4066
4070
|
}
|
|
4067
4071
|
return false;
|
|
4068
4072
|
}
|
|
4073
|
+
function getEditDistance(left, right) {
|
|
4074
|
+
const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
4075
|
+
const current = new Array(right.length + 1);
|
|
4076
|
+
for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
|
|
4077
|
+
current[0] = leftIndex + 1;
|
|
4078
|
+
for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
|
|
4079
|
+
const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
|
|
4080
|
+
current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
|
|
4081
|
+
}
|
|
4082
|
+
for (let index = 0;index < current.length; index += 1) {
|
|
4083
|
+
previous[index] = current[index];
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
return previous[right.length];
|
|
4087
|
+
}
|
|
4088
|
+
function isEdgeInsertionOrDeletionTypo(left, right) {
|
|
4089
|
+
if (Math.abs(left.length - right.length) !== 1) {
|
|
4090
|
+
return false;
|
|
4091
|
+
}
|
|
4092
|
+
const [shorter, longer] = left.length < right.length ? [left, right] : [right, left];
|
|
4093
|
+
return longer.startsWith(shorter) || longer.endsWith(shorter);
|
|
4094
|
+
}
|
|
4095
|
+
function suggestTopLevelCommandTypo(value) {
|
|
4096
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
4097
|
+
if (normalizedValue.length < 4) {
|
|
4098
|
+
return null;
|
|
4099
|
+
}
|
|
4100
|
+
let bestCandidate = null;
|
|
4101
|
+
for (const command of WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES) {
|
|
4102
|
+
const normalizedCommand = command.toLowerCase();
|
|
4103
|
+
const distance = getEditDistance(normalizedValue, normalizedCommand);
|
|
4104
|
+
if (distance > 2) {
|
|
4105
|
+
continue;
|
|
4106
|
+
}
|
|
4107
|
+
if (distance === 1 && isEdgeInsertionOrDeletionTypo(normalizedValue, normalizedCommand)) {
|
|
4108
|
+
continue;
|
|
4109
|
+
}
|
|
4110
|
+
if (distance > 1 && normalizedValue[0] !== normalizedCommand[0]) {
|
|
4111
|
+
continue;
|
|
4112
|
+
}
|
|
4113
|
+
if (bestCandidate === null || distance < bestCandidate.distance) {
|
|
4114
|
+
bestCandidate = { command, distance };
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
return bestCandidate?.command ?? null;
|
|
4118
|
+
}
|
|
4119
|
+
function assertNoLikelyTopLevelCommandTypo(value) {
|
|
4120
|
+
const suggestion = suggestTopLevelCommandTypo(value);
|
|
4121
|
+
if (!suggestion) {
|
|
4122
|
+
return;
|
|
4123
|
+
}
|
|
4124
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.INVALID_ARGUMENT, `Unknown top-level command "${value}". Did you mean "${suggestion}"? If you meant to create a project named "${value}", run \`${WP_TYPIA_CANONICAL_CREATE_USAGE.replace("<project-dir>", value)}\`.`);
|
|
4125
|
+
}
|
|
4069
4126
|
function resolveCanonicalCommandContext(argv) {
|
|
4070
4127
|
const positionalIndexes = collectPositionalIndexes(argv, COMMAND_ROUTING_METADATA);
|
|
4071
4128
|
const firstPositionalIndex = positionalIndexes[0] ?? -1;
|
|
@@ -4082,6 +4139,9 @@ function resolveCanonicalCommandContext(argv) {
|
|
|
4082
4139
|
if (isReservedTopLevelCommandName(firstPositional)) {
|
|
4083
4140
|
return firstPositional;
|
|
4084
4141
|
}
|
|
4142
|
+
if (suggestTopLevelCommandTypo(firstPositional)) {
|
|
4143
|
+
return firstPositional;
|
|
4144
|
+
}
|
|
4085
4145
|
return positionalIndexes.length === 1 ? "create" : firstPositional;
|
|
4086
4146
|
}
|
|
4087
4147
|
function assertStringOptionValues(argv) {
|
|
@@ -4172,6 +4232,7 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
4172
4232
|
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.INVALID_ARGUMENT, `The positional alias only accepts a single project directory. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` for scaffold invocations with additional positional arguments, or check the command spelling if you meant another top-level command. Extra positional arguments: ${extraPositionals.map((value) => `\`${value}\``).join(", ")}.`);
|
|
4173
4233
|
}
|
|
4174
4234
|
assertPositionalAliasProjectDir(firstPositional);
|
|
4235
|
+
assertNoLikelyTopLevelCommandTypo(firstPositional);
|
|
4175
4236
|
const normalizedArgv = [
|
|
4176
4237
|
...argv.slice(0, firstPositionalIndex),
|
|
4177
4238
|
"create",
|
|
@@ -4181,25 +4242,25 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
4181
4242
|
return normalizedArgv;
|
|
4182
4243
|
}
|
|
4183
4244
|
|
|
4184
|
-
// src/
|
|
4245
|
+
// src/portable-cli/help.ts
|
|
4185
4246
|
init_package();
|
|
4186
4247
|
init_add_kind_ids();
|
|
4187
4248
|
var STANDALONE_GUIDANCE_LINE = "Standalone wp-typia binaries are available from the GitHub release assets.";
|
|
4188
|
-
var
|
|
4249
|
+
var PORTABLE_CLI_RUNTIME_SUMMARY_LINES = [
|
|
4189
4250
|
"Runtime: Node-first wp-typia CLI",
|
|
4190
4251
|
"Gunshi provides the `complete` integration; the command registry owns shared dispatch and diagnostics.",
|
|
4191
4252
|
"Supported command surfaces include create/init/add/migrate flows, doctor, sync, templates, MCP metadata, skills, completions, --help, and --version.",
|
|
4192
4253
|
STANDALONE_GUIDANCE_LINE,
|
|
4193
4254
|
"Output markers: WP_TYPIA_ASCII=1 forces ASCII markers, WP_TYPIA_ASCII=0 opts back into Unicode markers, and non-empty NO_COLOR requests ASCII markers when WP_TYPIA_ASCII is unset."
|
|
4194
4255
|
];
|
|
4195
|
-
var
|
|
4256
|
+
var PORTABLE_CLI_NO_COMMAND_REASON_LINE = "No command provided. Run wp-typia --help for usage information.";
|
|
4196
4257
|
function renderGeneralHelp(printLine) {
|
|
4197
4258
|
printBlock(printLine, [
|
|
4198
4259
|
`wp-typia ${package_default.version}`,
|
|
4199
4260
|
"",
|
|
4200
4261
|
"Canonical CLI package for wp-typia scaffolding and project workflows.",
|
|
4201
4262
|
"",
|
|
4202
|
-
...
|
|
4263
|
+
...PORTABLE_CLI_RUNTIME_SUMMARY_LINES,
|
|
4203
4264
|
"",
|
|
4204
4265
|
"Commands:",
|
|
4205
4266
|
...WP_TYPIA_FUTURE_COMMAND_TREE.map((command) => `- ${command.name}: ${command.description}`),
|
|
@@ -4212,21 +4273,21 @@ function renderGeneralHelp(printLine) {
|
|
|
4212
4273
|
]);
|
|
4213
4274
|
}
|
|
4214
4275
|
function renderNoCommandHelp(printLine) {
|
|
4215
|
-
printBlock(printLine, [
|
|
4276
|
+
printBlock(printLine, [PORTABLE_CLI_NO_COMMAND_REASON_LINE, ""]);
|
|
4216
4277
|
renderGeneralHelp(printLine);
|
|
4217
4278
|
}
|
|
4218
|
-
function
|
|
4279
|
+
function renderPortableCliCommandHelp(printLine, config) {
|
|
4219
4280
|
printBlock(printLine, [
|
|
4220
4281
|
config.heading,
|
|
4221
4282
|
"",
|
|
4222
|
-
...
|
|
4283
|
+
...PORTABLE_CLI_RUNTIME_SUMMARY_LINES,
|
|
4223
4284
|
"",
|
|
4224
4285
|
...config.bodyLines ? [...config.bodyLines, ""] : [],
|
|
4225
4286
|
"Supported flags:",
|
|
4226
|
-
...
|
|
4287
|
+
...formatPortableCliOptionHelp(config.optionMetadata)
|
|
4227
4288
|
]);
|
|
4228
4289
|
}
|
|
4229
|
-
var
|
|
4290
|
+
var PORTABLE_CLI_COMMAND_HELP_CONFIG = {
|
|
4230
4291
|
add: {
|
|
4231
4292
|
bodyLines: [`Supported kinds: ${formatAddKindList()}`],
|
|
4232
4293
|
heading: "Usage: wp-typia add <kind> <name>",
|
|
@@ -4287,24 +4348,24 @@ var NODE_FALLBACK_COMMAND_HELP_CONFIG = {
|
|
|
4287
4348
|
optionMetadata: {}
|
|
4288
4349
|
}
|
|
4289
4350
|
};
|
|
4290
|
-
var
|
|
4351
|
+
var PORTABLE_CLI_HELP_RENDERERS = Object.fromEntries(Object.entries(PORTABLE_CLI_COMMAND_HELP_CONFIG).map(([command, config]) => [
|
|
4291
4352
|
command,
|
|
4292
|
-
(printLine) =>
|
|
4353
|
+
(printLine) => renderPortableCliCommandHelp(printLine, config)
|
|
4293
4354
|
]));
|
|
4294
4355
|
|
|
4295
|
-
// src/
|
|
4296
|
-
function
|
|
4356
|
+
// src/portable-cli/errors.ts
|
|
4357
|
+
function createPortableCliNoCommandCliError() {
|
|
4297
4358
|
return createCliCommandError3({
|
|
4298
4359
|
code: CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND,
|
|
4299
4360
|
command: "wp-typia",
|
|
4300
|
-
detailLines: [
|
|
4361
|
+
detailLines: [PORTABLE_CLI_NO_COMMAND_REASON_LINE],
|
|
4301
4362
|
summary: "No command was provided."
|
|
4302
4363
|
});
|
|
4303
4364
|
}
|
|
4304
|
-
function
|
|
4305
|
-
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(
|
|
4365
|
+
function isPortableCliNoCommandCliDiagnostic(error) {
|
|
4366
|
+
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES4.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(PORTABLE_CLI_NO_COMMAND_REASON_LINE);
|
|
4306
4367
|
}
|
|
4307
|
-
function
|
|
4368
|
+
function throwUnsupportedPortableCliCommand(command) {
|
|
4308
4369
|
throw createCliCommandError3({
|
|
4309
4370
|
code: CLI_DIAGNOSTIC_CODES4.UNSUPPORTED_COMMAND,
|
|
4310
4371
|
command,
|
|
@@ -4318,7 +4379,7 @@ function throwUnsupportedNodeFallbackCommand(command) {
|
|
|
4318
4379
|
summary: "Unsupported wp-typia command."
|
|
4319
4380
|
});
|
|
4320
4381
|
}
|
|
4321
|
-
async function
|
|
4382
|
+
async function handlePortableCliEntrypointError(error, argv) {
|
|
4322
4383
|
if (prefersStructuredCliArgv(argv)) {
|
|
4323
4384
|
const diagnostic = createCliCommandError3({
|
|
4324
4385
|
command: resolveCanonicalCommandContext(argv),
|
|
@@ -4332,7 +4393,7 @@ async function handleNodeFallbackEntrypointError(error, argv) {
|
|
|
4332
4393
|
process.exitCode = 1;
|
|
4333
4394
|
return;
|
|
4334
4395
|
}
|
|
4335
|
-
if (
|
|
4396
|
+
if (isPortableCliNoCommandCliDiagnostic(error)) {
|
|
4336
4397
|
process.exitCode = 1;
|
|
4337
4398
|
return;
|
|
4338
4399
|
}
|
|
@@ -4460,63 +4521,63 @@ import {
|
|
|
4460
4521
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
|
|
4461
4522
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError3
|
|
4462
4523
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
4463
|
-
import { z
|
|
4524
|
+
import { z } from "zod";
|
|
4464
4525
|
var WP_TYPIA_CONFIG_SOURCES = [
|
|
4465
4526
|
"~/.config/wp-typia/config.json",
|
|
4466
4527
|
".wp-typiarc",
|
|
4467
4528
|
".wp-typiarc.json"
|
|
4468
4529
|
];
|
|
4469
|
-
var wordpressVersionSchema =
|
|
4470
|
-
var wpTypiaSchemaSourceSchema =
|
|
4471
|
-
namespace:
|
|
4472
|
-
path:
|
|
4530
|
+
var wordpressVersionSchema = z.string().regex(/^\d+\.\d+(?:\.\d+)?$/u, 'expected dotted numeric WordPress version such as "6.7" or "6.7.1"');
|
|
4531
|
+
var wpTypiaSchemaSourceSchema = z.object({
|
|
4532
|
+
namespace: z.string(),
|
|
4533
|
+
path: z.string()
|
|
4473
4534
|
}).strict();
|
|
4474
|
-
var wordpressCompatibilityConfigSchema =
|
|
4535
|
+
var wordpressCompatibilityConfigSchema = z.object({
|
|
4475
4536
|
minVersion: wordpressVersionSchema.optional(),
|
|
4476
|
-
testedVersions:
|
|
4537
|
+
testedVersions: z.array(wordpressVersionSchema).optional()
|
|
4477
4538
|
}).strict();
|
|
4478
|
-
var blockApiCompatibilityConfigSchema =
|
|
4479
|
-
allowUnknownFutureKeys:
|
|
4480
|
-
strict:
|
|
4539
|
+
var blockApiCompatibilityConfigSchema = z.object({
|
|
4540
|
+
allowUnknownFutureKeys: z.boolean().optional(),
|
|
4541
|
+
strict: z.boolean().optional()
|
|
4481
4542
|
}).strict();
|
|
4482
|
-
var createConfigSchema =
|
|
4483
|
-
"alternate-render-targets":
|
|
4484
|
-
"inner-blocks-preset":
|
|
4485
|
-
"data-storage":
|
|
4486
|
-
"dry-run":
|
|
4487
|
-
"external-layer-id":
|
|
4488
|
-
"external-layer-source":
|
|
4489
|
-
namespace:
|
|
4490
|
-
"no-install":
|
|
4491
|
-
"package-manager":
|
|
4492
|
-
"persistence-policy":
|
|
4493
|
-
"php-prefix":
|
|
4494
|
-
profile:
|
|
4495
|
-
"query-post-type":
|
|
4496
|
-
template:
|
|
4497
|
-
"text-domain":
|
|
4498
|
-
variant:
|
|
4499
|
-
"with-migration-ui":
|
|
4500
|
-
"with-test-preset":
|
|
4501
|
-
"with-wp-env":
|
|
4502
|
-
yes:
|
|
4543
|
+
var createConfigSchema = z.object({
|
|
4544
|
+
"alternate-render-targets": z.string().optional(),
|
|
4545
|
+
"inner-blocks-preset": z.string().optional(),
|
|
4546
|
+
"data-storage": z.string().optional(),
|
|
4547
|
+
"dry-run": z.boolean().optional(),
|
|
4548
|
+
"external-layer-id": z.string().optional(),
|
|
4549
|
+
"external-layer-source": z.string().optional(),
|
|
4550
|
+
namespace: z.string().optional(),
|
|
4551
|
+
"no-install": z.boolean().optional(),
|
|
4552
|
+
"package-manager": z.string().optional(),
|
|
4553
|
+
"persistence-policy": z.string().optional(),
|
|
4554
|
+
"php-prefix": z.string().optional(),
|
|
4555
|
+
profile: z.string().optional(),
|
|
4556
|
+
"query-post-type": z.string().optional(),
|
|
4557
|
+
template: z.string().optional(),
|
|
4558
|
+
"text-domain": z.string().optional(),
|
|
4559
|
+
variant: z.string().optional(),
|
|
4560
|
+
"with-migration-ui": z.boolean().optional(),
|
|
4561
|
+
"with-test-preset": z.boolean().optional(),
|
|
4562
|
+
"with-wp-env": z.boolean().optional(),
|
|
4563
|
+
yes: z.boolean().optional()
|
|
4503
4564
|
}).strict();
|
|
4504
|
-
var addBlockConfigSchema =
|
|
4505
|
-
"alternate-render-targets":
|
|
4506
|
-
"data-storage":
|
|
4507
|
-
"external-layer-id":
|
|
4508
|
-
"external-layer-source":
|
|
4509
|
-
"inner-blocks-preset":
|
|
4510
|
-
"persistence-policy":
|
|
4511
|
-
template:
|
|
4565
|
+
var addBlockConfigSchema = z.object({
|
|
4566
|
+
"alternate-render-targets": z.string().optional(),
|
|
4567
|
+
"data-storage": z.string().optional(),
|
|
4568
|
+
"external-layer-id": z.string().optional(),
|
|
4569
|
+
"external-layer-source": z.string().optional(),
|
|
4570
|
+
"inner-blocks-preset": z.string().optional(),
|
|
4571
|
+
"persistence-policy": z.string().optional(),
|
|
4572
|
+
template: z.string().optional()
|
|
4512
4573
|
}).strict();
|
|
4513
|
-
var addConfigSchema =
|
|
4574
|
+
var addConfigSchema = z.object({
|
|
4514
4575
|
block: addBlockConfigSchema.optional()
|
|
4515
4576
|
}).strict();
|
|
4516
|
-
var mcpConfigSchema =
|
|
4517
|
-
schemaSources:
|
|
4577
|
+
var mcpConfigSchema = z.object({
|
|
4578
|
+
schemaSources: z.array(wpTypiaSchemaSourceSchema).optional()
|
|
4518
4579
|
}).strict();
|
|
4519
|
-
var wpTypiaUserConfigSchema =
|
|
4580
|
+
var wpTypiaUserConfigSchema = z.object({
|
|
4520
4581
|
add: addConfigSchema.optional(),
|
|
4521
4582
|
compatibility: blockApiCompatibilityConfigSchema.optional(),
|
|
4522
4583
|
create: createConfigSchema.optional(),
|
|
@@ -5117,8 +5178,10 @@ function optionNamesForGroups(groupNames) {
|
|
|
5117
5178
|
const options = new Set;
|
|
5118
5179
|
for (const groupName of groupNames) {
|
|
5119
5180
|
const metadata = COMMAND_OPTION_METADATA_BY_GROUP[groupName];
|
|
5120
|
-
for (const optionName of Object.
|
|
5121
|
-
|
|
5181
|
+
for (const [optionName, option] of Object.entries(metadata)) {
|
|
5182
|
+
if (!option.hidden) {
|
|
5183
|
+
options.add(optionName);
|
|
5184
|
+
}
|
|
5122
5185
|
}
|
|
5123
5186
|
}
|
|
5124
5187
|
return [...options].sort();
|
|
@@ -5357,9 +5420,9 @@ async function syncSkills(options = {}) {
|
|
|
5357
5420
|
};
|
|
5358
5421
|
}
|
|
5359
5422
|
|
|
5360
|
-
// src/
|
|
5423
|
+
// src/portable-cli/version.ts
|
|
5361
5424
|
init_package();
|
|
5362
|
-
function
|
|
5425
|
+
function renderPortableCliVersion(printLine, options = {}) {
|
|
5363
5426
|
if (options.format === "json") {
|
|
5364
5427
|
printLine(JSON.stringify({
|
|
5365
5428
|
ok: true,
|
|
@@ -5375,8 +5438,8 @@ function renderNodeFallbackVersion(printLine, options = {}) {
|
|
|
5375
5438
|
}
|
|
5376
5439
|
|
|
5377
5440
|
// src/node-cli.ts
|
|
5378
|
-
var
|
|
5379
|
-
var
|
|
5441
|
+
var PORTABLE_CLI_OPTION_PARSER = buildCommandOptionParser(ALL_COMMAND_OPTION_METADATA);
|
|
5442
|
+
var PORTABLE_CLI_BOOLEAN_OPTION_NAMES = ["help", "version"];
|
|
5380
5443
|
var printLine = (line) => {
|
|
5381
5444
|
console.log(line);
|
|
5382
5445
|
};
|
|
@@ -5397,7 +5460,7 @@ function hasFlagBeforeTerminator(argv, flag) {
|
|
|
5397
5460
|
function parseGlobalFlags(argv) {
|
|
5398
5461
|
const { argv: nextArgv, flags } = extractKnownOptionValuesFromArgv(argv, {
|
|
5399
5462
|
optionNames: ["format", "id"],
|
|
5400
|
-
parser:
|
|
5463
|
+
parser: PORTABLE_CLI_OPTION_PARSER
|
|
5401
5464
|
});
|
|
5402
5465
|
return {
|
|
5403
5466
|
argv: nextArgv,
|
|
@@ -5407,7 +5470,7 @@ function parseGlobalFlags(argv) {
|
|
|
5407
5470
|
}
|
|
5408
5471
|
};
|
|
5409
5472
|
}
|
|
5410
|
-
async function
|
|
5473
|
+
async function applyPortableCliConfigDefaults(command, subcommand, flags, config) {
|
|
5411
5474
|
if (command === "create") {
|
|
5412
5475
|
return {
|
|
5413
5476
|
...flags,
|
|
@@ -5441,34 +5504,34 @@ function commandNeedsNodeCliConfig(command, subcommand) {
|
|
|
5441
5504
|
}
|
|
5442
5505
|
function parseArgv(argv) {
|
|
5443
5506
|
return parseCommandArgvWithMetadata(argv, {
|
|
5444
|
-
extraBooleanOptionNames:
|
|
5445
|
-
parser:
|
|
5507
|
+
extraBooleanOptionNames: PORTABLE_CLI_BOOLEAN_OPTION_NAMES,
|
|
5508
|
+
parser: PORTABLE_CLI_OPTION_PARSER
|
|
5446
5509
|
});
|
|
5447
5510
|
}
|
|
5448
|
-
async function
|
|
5511
|
+
async function dispatchPortableCliCompletion({
|
|
5449
5512
|
positionals,
|
|
5450
5513
|
printLine: printLine2
|
|
5451
5514
|
}) {
|
|
5452
5515
|
const shell = positionals[1];
|
|
5453
5516
|
printLine2(renderCompletionScript(shell));
|
|
5454
5517
|
}
|
|
5455
|
-
var
|
|
5456
|
-
const {
|
|
5457
|
-
await
|
|
5518
|
+
var dispatchPortableCliAddLazy = async (context) => {
|
|
5519
|
+
const { dispatchPortableCliAdd: dispatchPortableCliAdd2 } = await Promise.resolve().then(() => (init_add2(), exports_add));
|
|
5520
|
+
await dispatchPortableCliAdd2(context);
|
|
5458
5521
|
};
|
|
5459
|
-
var
|
|
5460
|
-
const {
|
|
5461
|
-
await
|
|
5522
|
+
var dispatchPortableCliCreateLazy = async (context) => {
|
|
5523
|
+
const { dispatchPortableCliCreate: dispatchPortableCliCreate2 } = await Promise.resolve().then(() => (init_create2(), exports_create));
|
|
5524
|
+
await dispatchPortableCliCreate2(context);
|
|
5462
5525
|
};
|
|
5463
|
-
var
|
|
5464
|
-
const {
|
|
5465
|
-
await
|
|
5526
|
+
var dispatchPortableCliDoctorLazy = async (context) => {
|
|
5527
|
+
const { dispatchPortableCliDoctor: dispatchPortableCliDoctor2 } = await Promise.resolve().then(() => (init_doctor(), exports_doctor));
|
|
5528
|
+
await dispatchPortableCliDoctor2(context);
|
|
5466
5529
|
};
|
|
5467
|
-
var
|
|
5468
|
-
const {
|
|
5469
|
-
await
|
|
5530
|
+
var dispatchPortableCliTemplatesLazy = async (context) => {
|
|
5531
|
+
const { dispatchPortableCliTemplates: dispatchPortableCliTemplates2 } = await Promise.resolve().then(() => (init_templates(), exports_templates));
|
|
5532
|
+
await dispatchPortableCliTemplates2(context);
|
|
5470
5533
|
};
|
|
5471
|
-
async function
|
|
5534
|
+
async function dispatchPortableCliSkills({
|
|
5472
5535
|
cwd,
|
|
5473
5536
|
mergedFlags,
|
|
5474
5537
|
positionals,
|
|
@@ -5522,12 +5585,12 @@ async function dispatchNodeFallbackSkills({
|
|
|
5522
5585
|
]
|
|
5523
5586
|
});
|
|
5524
5587
|
}
|
|
5525
|
-
var
|
|
5526
|
-
add:
|
|
5527
|
-
complete:
|
|
5528
|
-
completions:
|
|
5529
|
-
create:
|
|
5530
|
-
doctor:
|
|
5588
|
+
var PORTABLE_CLI_COMMAND_DISPATCHERS = {
|
|
5589
|
+
add: dispatchPortableCliAddLazy,
|
|
5590
|
+
complete: dispatchPortableCliCompletion,
|
|
5591
|
+
completions: dispatchPortableCliCompletion,
|
|
5592
|
+
create: dispatchPortableCliCreateLazy,
|
|
5593
|
+
doctor: dispatchPortableCliDoctorLazy,
|
|
5531
5594
|
init: async ({
|
|
5532
5595
|
cwd,
|
|
5533
5596
|
mergedFlags,
|
|
@@ -5619,8 +5682,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
5619
5682
|
userConfig: config
|
|
5620
5683
|
});
|
|
5621
5684
|
},
|
|
5622
|
-
skills:
|
|
5623
|
-
templates:
|
|
5685
|
+
skills: dispatchPortableCliSkills,
|
|
5686
|
+
templates: dispatchPortableCliTemplatesLazy
|
|
5624
5687
|
};
|
|
5625
5688
|
async function runNodeCli(argv = process.argv.slice(2)) {
|
|
5626
5689
|
const normalizedArgv = normalizeWpTypiaArgv(argv);
|
|
@@ -5640,7 +5703,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
5640
5703
|
const helpTarget = command === "help" ? subcommand : command;
|
|
5641
5704
|
const versionRequested = hasFlagBeforeTerminator(cliArgv, "--version") || command === "version";
|
|
5642
5705
|
if (cliArgv.length === 0) {
|
|
5643
|
-
const noCommandError =
|
|
5706
|
+
const noCommandError = createPortableCliNoCommandCliError();
|
|
5644
5707
|
if (rawMergedFlags.format !== "json") {
|
|
5645
5708
|
renderNoCommandHelp(printLine);
|
|
5646
5709
|
}
|
|
@@ -5648,7 +5711,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
5648
5711
|
}
|
|
5649
5712
|
if (helpRequested) {
|
|
5650
5713
|
if (helpTarget) {
|
|
5651
|
-
const helpRenderer =
|
|
5714
|
+
const helpRenderer = PORTABLE_CLI_HELP_RENDERERS[helpTarget];
|
|
5652
5715
|
if (helpRenderer) {
|
|
5653
5716
|
helpRenderer(printLine);
|
|
5654
5717
|
return;
|
|
@@ -5665,16 +5728,16 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
5665
5728
|
return;
|
|
5666
5729
|
}
|
|
5667
5730
|
if (versionRequested) {
|
|
5668
|
-
|
|
5731
|
+
renderPortableCliVersion(printLine, {
|
|
5669
5732
|
format: typeof rawMergedFlags.format === "string" ? rawMergedFlags.format : undefined
|
|
5670
5733
|
});
|
|
5671
5734
|
return;
|
|
5672
5735
|
}
|
|
5673
|
-
const commandDispatcher = command &&
|
|
5736
|
+
const commandDispatcher = command && PORTABLE_CLI_COMMAND_DISPATCHERS[command];
|
|
5674
5737
|
if (commandDispatcher) {
|
|
5675
5738
|
const configNeeded = commandNeedsNodeCliConfig(command, subcommand);
|
|
5676
5739
|
const config = configNeeded ? await loadNodeCliConfig(process.cwd(), configOverridePath) : {};
|
|
5677
|
-
const mergedFlags = configNeeded ? await
|
|
5740
|
+
const mergedFlags = configNeeded ? await applyPortableCliConfigDefaults(command, subcommand, rawMergedFlags, config) : rawMergedFlags;
|
|
5678
5741
|
await commandDispatcher({
|
|
5679
5742
|
config,
|
|
5680
5743
|
cwd: process.cwd(),
|
|
@@ -5685,7 +5748,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
5685
5748
|
});
|
|
5686
5749
|
return;
|
|
5687
5750
|
}
|
|
5688
|
-
|
|
5751
|
+
throwUnsupportedPortableCliCommand(command ?? "(missing)");
|
|
5689
5752
|
}
|
|
5690
5753
|
|
|
5691
5754
|
// src/gunshi-cli.ts
|
|
@@ -5720,7 +5783,11 @@ function hasFlagBeforeTerminator2(argv, flag) {
|
|
|
5720
5783
|
}
|
|
5721
5784
|
function shouldUseGunshiCompletion(argv, versions = process.versions) {
|
|
5722
5785
|
const [command] = argv;
|
|
5723
|
-
return typeof versions.bun !== "string" && command === "complete" && !hasFlagBeforeTerminator2(argv, "--help") && !hasFlagBeforeTerminator2(argv, "-h") && !hasFlagBeforeTerminator2(argv, "--version") && !hasFlagBeforeTerminator2(argv, "-v");
|
|
5786
|
+
return typeof versions.bun !== "string" && (command === "complete" || command === "completions") && !hasFlagBeforeTerminator2(argv, "--help") && !hasFlagBeforeTerminator2(argv, "-h") && !hasFlagBeforeTerminator2(argv, "--version") && !hasFlagBeforeTerminator2(argv, "-v");
|
|
5787
|
+
}
|
|
5788
|
+
function normalizeGunshiCompletionArgv(argv) {
|
|
5789
|
+
const [command, ...rest] = argv;
|
|
5790
|
+
return command === "completions" ? ["complete", ...rest] : argv;
|
|
5724
5791
|
}
|
|
5725
5792
|
function completionEntries() {
|
|
5726
5793
|
return WP_TYPIA_COMMAND_REGISTRY.map((command) => ({
|
|
@@ -5753,7 +5820,7 @@ async function runGunshiCli(argv = process.argv.slice(2)) {
|
|
|
5753
5820
|
await runNodeCli(normalizeFallbackShortAliases(argv));
|
|
5754
5821
|
return;
|
|
5755
5822
|
}
|
|
5756
|
-
await cli(argv, wpTypiaGunshiCommand, {
|
|
5823
|
+
await cli(normalizeGunshiCompletionArgv(argv), wpTypiaGunshiCommand, {
|
|
5757
5824
|
fallbackToEntry: true,
|
|
5758
5825
|
name: "wp-typia",
|
|
5759
5826
|
plugins: [
|
|
@@ -5773,7 +5840,7 @@ async function runGunshiCliEntrypoint(argv = process.argv.slice(2)) {
|
|
|
5773
5840
|
try {
|
|
5774
5841
|
await runGunshiCli(argv);
|
|
5775
5842
|
} catch (error) {
|
|
5776
|
-
await
|
|
5843
|
+
await handlePortableCliEntrypointError(error, argv);
|
|
5777
5844
|
}
|
|
5778
5845
|
}
|
|
5779
5846
|
if (process.argv[1] && path9.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
@@ -5785,4 +5852,4 @@ export {
|
|
|
5785
5852
|
runGunshiCli
|
|
5786
5853
|
};
|
|
5787
5854
|
|
|
5788
|
-
//# debugId=
|
|
5855
|
+
//# debugId=4EF870F32E20097664756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-typia",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.6",
|
|
4
4
|
"description": "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
5
5
|
"packageManager": "bun@1.3.11",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@gunshi/plugin-completion": "0.32.0",
|
|
58
58
|
"@wp-typia/api-client": "^0.4.6",
|
|
59
|
-
"@wp-typia/project-tools": "0.24.
|
|
59
|
+
"@wp-typia/project-tools": "0.24.6",
|
|
60
60
|
"gunshi": "0.32.0",
|
|
61
61
|
"zod": "4.3.6"
|
|
62
62
|
},
|