wp-typia 0.16.10 → 0.16.12
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 -1
- package/bin/wp-typia.js +0 -0
- package/package.json +2 -2
- package/src/command-contract.ts +27 -4
package/README.md
CHANGED
|
@@ -12,7 +12,8 @@ Use this package for new installs:
|
|
|
12
12
|
- `wp-typia add hooked-block counter-card --anchor core/post-content --position after`
|
|
13
13
|
|
|
14
14
|
`wp-typia <project-dir>` remains available as a backward-compatible alias to
|
|
15
|
-
`wp-typia create <project-dir
|
|
15
|
+
`wp-typia create <project-dir>` when `<project-dir>` is the only positional
|
|
16
|
+
argument.
|
|
16
17
|
|
|
17
18
|
Compatibility notes:
|
|
18
19
|
|
|
@@ -26,5 +27,6 @@ for the active CLI ownership contract and the staged Bunli cutover plan.
|
|
|
26
27
|
Project meta docs:
|
|
27
28
|
|
|
28
29
|
- [Upgrade Guide](https://github.com/imjlk/wp-typia/blob/main/UPGRADE.md)
|
|
30
|
+
- [License](https://github.com/imjlk/wp-typia/blob/main/LICENSE)
|
|
29
31
|
- [Security Policy](https://github.com/imjlk/wp-typia/blob/main/SECURITY.md)
|
|
30
32
|
- [Contributing Guide](https://github.com/imjlk/wp-typia/blob/main/CONTRIBUTING.md)
|
package/bin/wp-typia.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-typia",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.12",
|
|
4
4
|
"description": "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
5
5
|
"packageManager": "bun@1.3.11",
|
|
6
6
|
"type": "module",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@bunli/tui": "0.6.0",
|
|
66
66
|
"@bunli/utils": "0.6.0",
|
|
67
67
|
"@wp-typia/api-client": "^0.4.4",
|
|
68
|
-
"@wp-typia/project-tools": "0.16.
|
|
68
|
+
"@wp-typia/project-tools": "0.16.11",
|
|
69
69
|
"better-result": "^2.7.0",
|
|
70
70
|
"react": "^19.2.5",
|
|
71
71
|
"react-dom": "^19.2.5",
|
package/src/command-contract.ts
CHANGED
|
@@ -84,13 +84,24 @@ function isLongOptionValueConsumer(optionName: string): boolean {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function findFirstPositionalIndex(argv: string[]): number {
|
|
87
|
+
const positionalIndexes = collectPositionalIndexes(argv);
|
|
88
|
+
return positionalIndexes[0] ?? -1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function collectPositionalIndexes(argv: string[]): number[] {
|
|
92
|
+
const positionalIndexes: number[] = [];
|
|
93
|
+
|
|
87
94
|
for (let index = 0; index < argv.length; index += 1) {
|
|
88
95
|
const arg = argv[index];
|
|
89
96
|
if (arg === "--") {
|
|
90
|
-
|
|
97
|
+
for (let restIndex = index + 1; restIndex < argv.length; restIndex += 1) {
|
|
98
|
+
positionalIndexes.push(restIndex);
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
91
101
|
}
|
|
92
102
|
if (!arg.startsWith("-") || arg === "-") {
|
|
93
|
-
|
|
103
|
+
positionalIndexes.push(index);
|
|
104
|
+
continue;
|
|
94
105
|
}
|
|
95
106
|
if (arg.startsWith("--")) {
|
|
96
107
|
if (arg.includes("=")) {
|
|
@@ -106,7 +117,7 @@ function findFirstPositionalIndex(argv: string[]): number {
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
|
|
109
|
-
return
|
|
120
|
+
return positionalIndexes;
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
export const WP_TYPIA_FUTURE_COMMAND_TREE = [
|
|
@@ -213,7 +224,8 @@ function assertStringOptionValues(argv: string[]): void {
|
|
|
213
224
|
}
|
|
214
225
|
|
|
215
226
|
export function normalizeWpTypiaArgv(argv: string[]): string[] {
|
|
216
|
-
const
|
|
227
|
+
const positionalIndexes = collectPositionalIndexes(argv);
|
|
228
|
+
const firstPositionalIndex = positionalIndexes[0] ?? -1;
|
|
217
229
|
if (firstPositionalIndex === -1) {
|
|
218
230
|
return argv;
|
|
219
231
|
}
|
|
@@ -234,6 +246,17 @@ export function normalizeWpTypiaArgv(argv: string[]): string[] {
|
|
|
234
246
|
return argv;
|
|
235
247
|
}
|
|
236
248
|
|
|
249
|
+
if (positionalIndexes.length > 1) {
|
|
250
|
+
const extraPositionals = positionalIndexes
|
|
251
|
+
.slice(1)
|
|
252
|
+
.map((index) => argv[index])
|
|
253
|
+
.filter((value): value is string => typeof value === "string" && value.length > 0);
|
|
254
|
+
|
|
255
|
+
throw new Error(
|
|
256
|
+
`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(", ")}.`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
237
260
|
const normalizedArgv = [
|
|
238
261
|
...argv.slice(0, firstPositionalIndex),
|
|
239
262
|
"create",
|