wp-typia 0.23.0 → 0.23.1
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 +2 -1
- package/bin/routing-metadata.generated.js +4 -0
- package/dist-bunli/.bunli/commands.gen.js +4103 -3086
- package/dist-bunli/{cli-hhp1d348.js → cli-1170yyve.js} +8 -7
- package/dist-bunli/{cli-qse6myha.js → cli-8hxf9qw6.js} +11 -3
- package/dist-bunli/{cli-8reep89s.js → cli-9fx0qgb7.js} +2 -2
- package/dist-bunli/{cli-add-21bvpfgw.js → cli-add-xjaaa01x.js} +1560 -1525
- package/dist-bunli/{cli-52ke0ptp.js → cli-am5x7tb4.js} +8 -2
- package/dist-bunli/cli-ccax7s0s.js +34 -0
- package/dist-bunli/{cli-diagnostics-5dvztm7q.js → cli-diagnostics-10drxh34.js} +1 -1
- package/dist-bunli/{cli-doctor-wy2yjsge.js → cli-doctor-19e8313m.js} +602 -459
- package/dist-bunli/{cli-2rqf6t0b.js → cli-e4bwd81c.js} +8 -11
- package/dist-bunli/{cli-9npd9was.js → cli-epsczb1c.js} +12 -10
- package/dist-bunli/{cli-agywa5n6.js → cli-fp16mntv.js} +8 -4
- package/dist-bunli/{cli-init-xnsbxncv.js → cli-init-2b4yn2cc.js} +14 -10
- package/dist-bunli/{cli-ts9thts5.js → cli-k5q5v8g6.js} +184 -162
- package/dist-bunli/{cli-c2acv5dv.js → cli-nvs5atj1.js} +2 -2
- package/dist-bunli/{cli-prompt-614tq57c.js → cli-prompt-ncyg68rn.js} +1 -1
- package/dist-bunli/{cli-bq2v559b.js → cli-rdcga1bd.js} +31 -13
- package/dist-bunli/{cli-scaffold-zhp2ym8z.js → cli-scaffold-4tjw4jk5.js} +27 -15
- package/dist-bunli/{cli-templates-hc71dfc2.js → cli-templates-g8t4fm11.js} +3 -2
- package/dist-bunli/{cli-p95wr1q8.js → cli-tq730sqt.js} +6 -3
- package/dist-bunli/{cli-1meywwsy.js → cli-y7w3pybs.js} +848 -246
- package/dist-bunli/{cli-z5qkx2pn.js → cli-ymecd15q.js} +37 -10
- package/dist-bunli/cli.js +4 -4
- package/dist-bunli/{command-list-aqrkx021.js → command-list-vme7dr5v.js} +81 -45
- package/dist-bunli/{create-template-validation-rtec5sng.js → create-template-validation-4fr851vg.js} +5 -4
- package/dist-bunli/{migrations-bx0yvc2v.js → migrations-pb5vvtdp.js} +9 -8
- package/dist-bunli/node-cli.js +399 -317
- package/dist-bunli/{workspace-project-csnnggz6.js → workspace-project-gmv2a71z.js} +4 -3
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -1,108 +1,8 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
|
-
// package.json
|
|
4
|
-
var package_default = {
|
|
5
|
-
name: "wp-typia",
|
|
6
|
-
version: "0.23.0",
|
|
7
|
-
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
8
|
-
packageManager: "bun@1.3.11",
|
|
9
|
-
type: "module",
|
|
10
|
-
bin: {
|
|
11
|
-
"wp-typia": "bin/wp-typia.js"
|
|
12
|
-
},
|
|
13
|
-
files: [
|
|
14
|
-
"bin/",
|
|
15
|
-
"dist-bunli/",
|
|
16
|
-
"README.md",
|
|
17
|
-
"package.json"
|
|
18
|
-
],
|
|
19
|
-
scripts: {
|
|
20
|
-
"generate:routing": "node scripts/generate-routing-metadata.mjs",
|
|
21
|
-
"validate:routing": "node scripts/generate-routing-metadata.mjs --check",
|
|
22
|
-
generate: "node scripts/generate-routing-metadata.mjs && bun scripts/generate-bunli-metadata.ts",
|
|
23
|
-
build: "bun run generate && bun scripts/build-bunli-runtime.ts",
|
|
24
|
-
"build:standalone": "bun scripts/build-standalone-runtime.ts --targets native --outdir ./dist-standalone",
|
|
25
|
-
"build:standalone:release": "bun scripts/build-standalone-runtime.ts --targets darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 --outdir ./.cache/standalone/raw",
|
|
26
|
-
"bunli:generate": "bun run generate",
|
|
27
|
-
"bunli:build": "bun run build",
|
|
28
|
-
"bunli:dev": "bun src/cli.ts",
|
|
29
|
-
"bunli:test": "bun test tests/*.test.ts",
|
|
30
|
-
dev: "bun run build && node bin/wp-typia.js",
|
|
31
|
-
"standalone:prepare-release-assets": "bun scripts/prepare-standalone-release-assets.ts --input-dir ./.cache/standalone/raw --outdir ./.cache/standalone/release-assets",
|
|
32
|
-
test: "cd ../wp-typia-project-tools && bun run build && cd ../wp-typia && bun run build && bun test tests/*.test.ts",
|
|
33
|
-
"test:coverage": "cd ../wp-typia-project-tools && bun run build && cd ../wp-typia && bun run build && bun test tests/*.test.ts --coverage --coverage-reporter=lcov --coverage-dir=coverage",
|
|
34
|
-
clean: "rm -rf .bunli .cache/standalone .pack-backup dist-bunli dist-standalone",
|
|
35
|
-
prepack: "bun run build && node ./scripts/publish-runtime-maps.mjs prepare",
|
|
36
|
-
postpack: "node ./scripts/publish-runtime-maps.mjs restore"
|
|
37
|
-
},
|
|
38
|
-
keywords: [
|
|
39
|
-
"wordpress",
|
|
40
|
-
"gutenberg",
|
|
41
|
-
"typia",
|
|
42
|
-
"cli",
|
|
43
|
-
"scaffold",
|
|
44
|
-
"templates"
|
|
45
|
-
],
|
|
46
|
-
author: "imjlk",
|
|
47
|
-
license: "GPL-2.0-or-later",
|
|
48
|
-
repository: {
|
|
49
|
-
type: "git",
|
|
50
|
-
url: "git+https://github.com/imjlk/wp-typia.git",
|
|
51
|
-
directory: "packages/wp-typia"
|
|
52
|
-
},
|
|
53
|
-
bugs: {
|
|
54
|
-
url: "https://github.com/imjlk/wp-typia/issues"
|
|
55
|
-
},
|
|
56
|
-
homepage: "https://github.com/imjlk/wp-typia/tree/main/packages/wp-typia#readme",
|
|
57
|
-
publishConfig: {
|
|
58
|
-
access: "public"
|
|
59
|
-
},
|
|
60
|
-
engines: {
|
|
61
|
-
bun: ">=1.3.11",
|
|
62
|
-
node: ">=20.0.0",
|
|
63
|
-
npm: ">=10.0.0"
|
|
64
|
-
},
|
|
65
|
-
dependencies: {
|
|
66
|
-
"@bunli/core": "0.9.0",
|
|
67
|
-
"@bunli/plugin-ai-detect": "0.6.4",
|
|
68
|
-
"@bunli/plugin-completions": "0.3.5",
|
|
69
|
-
"@bunli/plugin-config": "0.4.4",
|
|
70
|
-
"@bunli/plugin-mcp": "0.2.5",
|
|
71
|
-
"@bunli/plugin-skills": "0.1.0",
|
|
72
|
-
"@bunli/runtime": "0.3.1",
|
|
73
|
-
"@bunli/tui": "0.6.0",
|
|
74
|
-
"@bunli/utils": "0.6.0",
|
|
75
|
-
"@wp-typia/api-client": "^0.4.5",
|
|
76
|
-
"@wp-typia/project-tools": "0.23.0",
|
|
77
|
-
"better-result": "^2.7.0",
|
|
78
|
-
react: "^19.2.5",
|
|
79
|
-
"react-dom": "^19.2.5",
|
|
80
|
-
zod: "4.3.6"
|
|
81
|
-
},
|
|
82
|
-
devDependencies: {
|
|
83
|
-
"@bunli/generator": "0.6.5",
|
|
84
|
-
"@bunli/test": "0.6.0",
|
|
85
|
-
bunli: "0.9.0",
|
|
86
|
-
typescript: "^5.9.2"
|
|
87
|
-
},
|
|
88
|
-
optionalDependencies: {
|
|
89
|
-
"@opentui/core-darwin-arm64": "0.1.97",
|
|
90
|
-
"@opentui/core-darwin-x64": "0.1.97",
|
|
91
|
-
"@opentui/core-linux-arm64": "0.1.97",
|
|
92
|
-
"@opentui/core-linux-x64": "0.1.97",
|
|
93
|
-
"@opentui/core-win32-arm64": "0.1.97",
|
|
94
|
-
"@opentui/core-win32-x64": "0.1.97"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
3
|
|
|
98
4
|
// src/node-cli.ts
|
|
99
|
-
import {
|
|
100
|
-
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
|
|
101
|
-
createCliCommandError as createCliCommandError5,
|
|
102
|
-
formatCliDiagnosticError,
|
|
103
|
-
isCliDiagnosticError,
|
|
104
|
-
serializeCliDiagnosticError as serializeCliDiagnosticError2
|
|
105
|
-
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
5
|
+
import { createCliCommandError as createCliCommandError8 } from "@wp-typia/project-tools/cli-diagnostics";
|
|
106
6
|
|
|
107
7
|
// src/command-option-metadata.ts
|
|
108
8
|
import { z } from "zod";
|
|
@@ -134,11 +34,11 @@ var ADD_OPTION_METADATA = {
|
|
|
134
34
|
type: "string"
|
|
135
35
|
},
|
|
136
36
|
"controller-class": {
|
|
137
|
-
description: "
|
|
37
|
+
description: "REST resource controller class used for generated route callbacks or declared manual/provider route ownership.",
|
|
138
38
|
type: "string"
|
|
139
39
|
},
|
|
140
40
|
"controller-extends": {
|
|
141
|
-
description: "Optional base class for generated REST resource controller wrappers.",
|
|
41
|
+
description: "Optional base class for generated REST resource controller wrappers or declared manual/provider controller ownership.",
|
|
142
42
|
type: "string"
|
|
143
43
|
},
|
|
144
44
|
"data-storage": {
|
|
@@ -193,7 +93,7 @@ var ADD_OPTION_METADATA = {
|
|
|
193
93
|
type: "string"
|
|
194
94
|
},
|
|
195
95
|
"permission-callback": {
|
|
196
|
-
description: "PHP permission callback for generated
|
|
96
|
+
description: "PHP permission callback for generated route registrations or declared manual/provider route ownership.",
|
|
197
97
|
type: "string"
|
|
198
98
|
},
|
|
199
99
|
"post-type": {
|
|
@@ -220,16 +120,33 @@ var ADD_OPTION_METADATA = {
|
|
|
220
120
|
description: "Exported TypeScript response type for manual REST contract workflows.",
|
|
221
121
|
type: "string"
|
|
222
122
|
},
|
|
123
|
+
"release-zip": {
|
|
124
|
+
argumentKind: "flag",
|
|
125
|
+
description: "Add release zip packaging scripts for integration-env plugin QA workflows.",
|
|
126
|
+
type: "boolean"
|
|
127
|
+
},
|
|
223
128
|
"route-pattern": {
|
|
224
|
-
description: "
|
|
129
|
+
description: "REST route pattern relative to the namespace; generated resources use it for item routes and manual/provider contracts may use it as an alias for --path.",
|
|
225
130
|
type: "string"
|
|
226
131
|
},
|
|
227
132
|
"secret-field": {
|
|
228
|
-
description: "Write-only request body field for manual settings REST contracts.",
|
|
133
|
+
description: "Write-only request body field for manual settings REST contracts; requires --manual and a request body, typically generated by POST, PUT, or PATCH.",
|
|
134
|
+
type: "string"
|
|
135
|
+
},
|
|
136
|
+
"secret-has-value-field": {
|
|
137
|
+
description: "Alias for --secret-state-field when the manual settings response exposes a safe has-value indicator.",
|
|
138
|
+
type: "string"
|
|
139
|
+
},
|
|
140
|
+
"secret-masked-response-field": {
|
|
141
|
+
description: "Alias for --secret-state-field when the manual settings response exposes masked secret state.",
|
|
142
|
+
type: "string"
|
|
143
|
+
},
|
|
144
|
+
"secret-preserve-on-empty": {
|
|
145
|
+
description: "Whether blank manual settings secret submissions should preserve the stored secret (true by default).",
|
|
229
146
|
type: "string"
|
|
230
147
|
},
|
|
231
148
|
"secret-state-field": {
|
|
232
|
-
description: "Masked response boolean field for --secret-field; defaults to has<SecretField
|
|
149
|
+
description: "Masked response boolean field for --secret-field; defaults to has<SecretField> and may also be provided as --secret-has-value-field.",
|
|
233
150
|
type: "string"
|
|
234
151
|
},
|
|
235
152
|
service: {
|
|
@@ -315,6 +232,10 @@ var CREATE_OPTION_METADATA = {
|
|
|
315
232
|
description: "Custom PHP symbol prefix.",
|
|
316
233
|
type: "string"
|
|
317
234
|
},
|
|
235
|
+
profile: {
|
|
236
|
+
description: "Opt-in scaffold profile; use plugin-qa with --template workspace for wp-env, smoke, and release zip starters.",
|
|
237
|
+
type: "string"
|
|
238
|
+
},
|
|
318
239
|
"query-post-type": {
|
|
319
240
|
description: "Default post type assigned to Query Loop variation scaffolds.",
|
|
320
241
|
type: "string"
|
|
@@ -359,6 +280,11 @@ var DOCTOR_OPTION_METADATA = {
|
|
|
359
280
|
format: {
|
|
360
281
|
description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
|
|
361
282
|
type: "string"
|
|
283
|
+
},
|
|
284
|
+
"workspace-only": {
|
|
285
|
+
argumentKind: "flag",
|
|
286
|
+
description: "Fail only on workspace-scoped doctor checks; environment/runtime failures remain advisory in JSON summaries.",
|
|
287
|
+
type: "boolean"
|
|
362
288
|
}
|
|
363
289
|
};
|
|
364
290
|
// src/command-options/global.ts
|
|
@@ -678,10 +604,10 @@ function resolveCommandOptionValues(metadata, options) {
|
|
|
678
604
|
return resolved;
|
|
679
605
|
}
|
|
680
606
|
|
|
681
|
-
// src/cli-
|
|
607
|
+
// src/cli-output-format.ts
|
|
682
608
|
import {
|
|
683
|
-
|
|
684
|
-
|
|
609
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
|
|
610
|
+
createCliCommandError
|
|
685
611
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
686
612
|
|
|
687
613
|
// bin/argv-walker.js
|
|
@@ -735,10 +661,6 @@ function resolveEntrypointCliCommand(argv) {
|
|
|
735
661
|
}
|
|
736
662
|
|
|
737
663
|
// src/cli-output-format.ts
|
|
738
|
-
import {
|
|
739
|
-
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
|
|
740
|
-
createCliCommandError
|
|
741
|
-
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
742
664
|
var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
|
|
743
665
|
var LEGACY_CLI_OUTPUT_FORMAT_ALIASES = ["toon"];
|
|
744
666
|
var SUPPORTED_CLI_OUTPUT_FORMATS = [
|
|
@@ -819,32 +741,6 @@ function validateCliOutputFormatArgv(argv) {
|
|
|
819
741
|
}
|
|
820
742
|
}
|
|
821
743
|
|
|
822
|
-
// src/cli-diagnostic-output.ts
|
|
823
|
-
function prefersStructuredCliArgv(argv) {
|
|
824
|
-
for (let index = 0;index < argv.length; index += 1) {
|
|
825
|
-
const arg = argv[index];
|
|
826
|
-
if (!arg) {
|
|
827
|
-
continue;
|
|
828
|
-
}
|
|
829
|
-
if (arg === "--") {
|
|
830
|
-
return false;
|
|
831
|
-
}
|
|
832
|
-
if (arg === "--format") {
|
|
833
|
-
return argv[index + 1] === "json";
|
|
834
|
-
}
|
|
835
|
-
if (arg.startsWith("--format=")) {
|
|
836
|
-
return arg.slice("--format=".length) === "json";
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
return false;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
// src/node-cli.ts
|
|
843
|
-
import {
|
|
844
|
-
getTemplateById,
|
|
845
|
-
listTemplates
|
|
846
|
-
} from "@wp-typia/project-tools/cli-templates";
|
|
847
|
-
|
|
848
744
|
// src/config.ts
|
|
849
745
|
import fs from "node:fs/promises";
|
|
850
746
|
import os from "node:os";
|
|
@@ -876,6 +772,7 @@ var createConfigSchema = z2.object({
|
|
|
876
772
|
"package-manager": z2.string().optional(),
|
|
877
773
|
"persistence-policy": z2.string().optional(),
|
|
878
774
|
"php-prefix": z2.string().optional(),
|
|
775
|
+
profile: z2.string().optional(),
|
|
879
776
|
"query-post-type": z2.string().optional(),
|
|
880
777
|
template: z2.string().optional(),
|
|
881
778
|
"text-domain": z2.string().optional(),
|
|
@@ -1590,17 +1487,19 @@ var hookedBlockAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1590
1487
|
});
|
|
1591
1488
|
|
|
1592
1489
|
// src/add-kinds/integration-env.ts
|
|
1593
|
-
var INTEGRATION_ENV_MISSING_NAME_MESSAGE = "`wp-typia add integration-env` requires <name>. Usage: wp-typia add integration-env <name> [--wp-env] [--service <none|docker-compose>].";
|
|
1490
|
+
var INTEGRATION_ENV_MISSING_NAME_MESSAGE = "`wp-typia add integration-env` requires <name>. Usage: wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>].";
|
|
1594
1491
|
var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
1595
1492
|
completion: {
|
|
1596
1493
|
nextSteps: (values) => [
|
|
1597
1494
|
`Review scripts/integration-smoke/${values.integrationEnvSlug}.mjs and docs/integration-env/${values.integrationEnvSlug}.md.`,
|
|
1598
1495
|
"Copy `.env.example` to `.env`, adjust local URLs or credentials, then run the generated smoke script.",
|
|
1599
|
-
...values.withWpEnv === "true" ? ["Run `npm run wp-env:start` before the smoke check when using the generated wp-env preset."] : []
|
|
1496
|
+
...values.withWpEnv === "true" ? ["Run `npm run wp-env:start` before the smoke check when using the generated wp-env preset."] : [],
|
|
1497
|
+
...values.withReleaseZip === "true" ? ["Run `npm run release:zip` after smoke checks pass to build a distributable plugin zip."] : []
|
|
1600
1498
|
],
|
|
1601
1499
|
summaryLines: (values, projectDir) => [
|
|
1602
1500
|
`Integration env: ${values.integrationEnvSlug}`,
|
|
1603
1501
|
`wp-env preset: ${values.withWpEnv}`,
|
|
1502
|
+
`Release zip scripts: ${values.withReleaseZip}`,
|
|
1604
1503
|
`Service starter: ${values.service}`,
|
|
1605
1504
|
`Project directory: ${projectDir}`
|
|
1606
1505
|
],
|
|
@@ -1610,17 +1509,20 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1610
1509
|
nameLabel: "Integration env name",
|
|
1611
1510
|
async prepareExecution(context) {
|
|
1612
1511
|
const service = readOptionalStrictStringFlag(context.flags, "service");
|
|
1512
|
+
const withReleaseZip = Boolean(context.flags["release-zip"]);
|
|
1613
1513
|
const withWpEnv = Boolean(context.flags["wp-env"]);
|
|
1614
1514
|
return createNamedExecutionPlan(context, {
|
|
1615
1515
|
execute: ({ cwd, name }) => context.addRuntime.runAddIntegrationEnvCommand({
|
|
1616
1516
|
cwd,
|
|
1617
1517
|
integrationEnvName: name,
|
|
1618
1518
|
service,
|
|
1519
|
+
withReleaseZip,
|
|
1619
1520
|
withWpEnv
|
|
1620
1521
|
}),
|
|
1621
1522
|
getValues: (result) => ({
|
|
1622
1523
|
integrationEnvSlug: result.integrationEnvSlug,
|
|
1623
1524
|
service: result.service,
|
|
1525
|
+
withReleaseZip: String(result.withReleaseZip),
|
|
1624
1526
|
withWpEnv: String(result.withWpEnv)
|
|
1625
1527
|
}),
|
|
1626
1528
|
getWarnings: (result) => result.warnings,
|
|
@@ -1630,8 +1532,9 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1630
1532
|
},
|
|
1631
1533
|
sortOrder: 25,
|
|
1632
1534
|
supportsDryRun: true,
|
|
1633
|
-
usage: "wp-typia add integration-env <name> [--wp-env] [--service <none|docker-compose>] [--dry-run]",
|
|
1634
|
-
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
|
|
1535
|
+
usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
|
|
1536
|
+
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
|
|
1537
|
+
hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
|
|
1635
1538
|
});
|
|
1636
1539
|
|
|
1637
1540
|
// src/add-kinds/pattern.ts
|
|
@@ -1731,10 +1634,16 @@ var postMetaAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1731
1634
|
});
|
|
1732
1635
|
|
|
1733
1636
|
// src/add-kinds/rest-resource.ts
|
|
1734
|
-
var
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
}
|
|
1637
|
+
var REST_RESOURCE_GENERATED_USAGE = "Generated: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--dry-run]";
|
|
1638
|
+
var REST_RESOURCE_MANUAL_USAGE = "Manual: wp-typia add rest-resource <name> --manual [--namespace <vendor/v1>] [--method <GET|POST|PUT|PATCH|DELETE>] [--auth <public|authenticated|public-write-protected>] [--path <route-pattern>|--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--query-type <Type>] [--body-type <Type>] [--response-type <Type>] [--secret-field <field>] [--secret-state-field|--secret-has-value-field <field>] [--secret-preserve-on-empty <true|false>] [--dry-run]";
|
|
1639
|
+
var REST_RESOURCE_USAGE = `${REST_RESOURCE_GENERATED_USAGE}
|
|
1640
|
+
${REST_RESOURCE_MANUAL_USAGE}`;
|
|
1641
|
+
var REST_RESOURCE_MISSING_NAME_MESSAGE = [
|
|
1642
|
+
"`wp-typia add rest-resource` requires <name>. Usage:",
|
|
1643
|
+
` ${REST_RESOURCE_GENERATED_USAGE}`,
|
|
1644
|
+
` ${REST_RESOURCE_MANUAL_USAGE}`
|
|
1645
|
+
].join(`
|
|
1646
|
+
`);
|
|
1738
1647
|
var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
1739
1648
|
completion: {
|
|
1740
1649
|
nextSteps: (values) => values.mode === "manual" ? [
|
|
@@ -1752,8 +1661,12 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1752
1661
|
`Route: ${values.method} /${values.namespace}${values.pathPattern}`,
|
|
1753
1662
|
`Auth: ${values.auth}`,
|
|
1754
1663
|
...values.secretFieldName ? [
|
|
1755
|
-
`Secret field: ${values.secretFieldName} -> ${values.secretStateFieldName}
|
|
1756
|
-
|
|
1664
|
+
`Secret field: ${values.secretFieldName} -> ${values.secretStateFieldName}`,
|
|
1665
|
+
`Secret preserve on empty: ${values.secretPreserveOnEmpty}`
|
|
1666
|
+
] : [],
|
|
1667
|
+
...values.permissionCallback ? [`Declared permission callback: ${values.permissionCallback}`] : [],
|
|
1668
|
+
...values.controllerClass ? [`Declared controller class: ${values.controllerClass}`] : [],
|
|
1669
|
+
...values.controllerExtends ? [`Declared controller base: ${values.controllerExtends}`] : []
|
|
1757
1670
|
] : [
|
|
1758
1671
|
`Methods: ${values.methods}`,
|
|
1759
1672
|
...values.routePattern ? [`Item route: /${values.namespace}${values.routePattern}`] : [],
|
|
@@ -1778,6 +1691,9 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1778
1691
|
"response-type",
|
|
1779
1692
|
"route-pattern",
|
|
1780
1693
|
"secret-field",
|
|
1694
|
+
"secret-has-value-field",
|
|
1695
|
+
"secret-masked-response-field",
|
|
1696
|
+
"secret-preserve-on-empty",
|
|
1781
1697
|
"secret-state-field"
|
|
1782
1698
|
],
|
|
1783
1699
|
nameLabel: "REST resource name",
|
|
@@ -1785,19 +1701,22 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1785
1701
|
const name = requireAddKindName(context, REST_RESOURCE_MISSING_NAME_MESSAGE);
|
|
1786
1702
|
const auth = readOptionalStrictStringFlag(context.flags, "auth");
|
|
1787
1703
|
const bodyTypeName = readOptionalStrictStringFlag(context.flags, "body-type");
|
|
1788
|
-
const controllerClass =
|
|
1789
|
-
const controllerExtends =
|
|
1704
|
+
const controllerClass = readOptionalDashedOrCamelStringFlag(context.flags, "controller-class", "controllerClass");
|
|
1705
|
+
const controllerExtends = readOptionalDashedOrCamelStringFlag(context.flags, "controller-extends", "controllerExtends");
|
|
1790
1706
|
const manual = Boolean(context.flags.manual);
|
|
1791
1707
|
const method = readOptionalStrictStringFlag(context.flags, "method");
|
|
1792
1708
|
const methods = readOptionalStrictStringFlag(context.flags, "methods");
|
|
1793
1709
|
const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
|
|
1794
|
-
const permissionCallback =
|
|
1710
|
+
const permissionCallback = readOptionalDashedOrCamelStringFlag(context.flags, "permission-callback", "permissionCallback");
|
|
1795
1711
|
const pathPattern = readOptionalStrictStringFlag(context.flags, "path");
|
|
1796
1712
|
const queryTypeName = readOptionalStrictStringFlag(context.flags, "query-type");
|
|
1797
1713
|
const responseTypeName = readOptionalStrictStringFlag(context.flags, "response-type");
|
|
1798
|
-
const routePattern =
|
|
1799
|
-
const secretFieldName =
|
|
1800
|
-
const
|
|
1714
|
+
const routePattern = readOptionalDashedOrCamelStringFlag(context.flags, "route-pattern", "routePattern");
|
|
1715
|
+
const secretFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-field", "secretField");
|
|
1716
|
+
const secretHasValueFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-has-value-field", "secretHasValueField");
|
|
1717
|
+
const secretMaskedResponseFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-masked-response-field", "secretMaskedResponseField");
|
|
1718
|
+
const secretPreserveOnEmpty = readOptionalDashedOrCamelStringFlag(context.flags, "secret-preserve-on-empty", "secretPreserveOnEmpty");
|
|
1719
|
+
const secretStateFieldName = readOptionalDashedOrCamelStringFlag(context.flags, "secret-state-field", "secretStateField");
|
|
1801
1720
|
return createNamedExecutionPlan(context, {
|
|
1802
1721
|
execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
|
|
1803
1722
|
auth,
|
|
@@ -1816,11 +1735,15 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1816
1735
|
responseTypeName,
|
|
1817
1736
|
routePattern,
|
|
1818
1737
|
secretFieldName,
|
|
1738
|
+
secretHasValueFieldName,
|
|
1739
|
+
secretMaskedResponseFieldName,
|
|
1740
|
+
secretPreserveOnEmpty,
|
|
1819
1741
|
secretStateFieldName
|
|
1820
1742
|
}),
|
|
1821
1743
|
getValues: (result) => ({
|
|
1822
1744
|
auth: result.auth ?? "",
|
|
1823
1745
|
controllerClass: result.controllerClass ?? "",
|
|
1746
|
+
controllerExtends: result.controllerExtends ?? "",
|
|
1824
1747
|
method: result.method ?? "",
|
|
1825
1748
|
methods: result.methods.join(", "),
|
|
1826
1749
|
mode: result.mode,
|
|
@@ -1830,6 +1753,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1830
1753
|
restResourceSlug: result.restResourceSlug,
|
|
1831
1754
|
routePattern: result.routePattern ?? "",
|
|
1832
1755
|
secretFieldName: result.secretFieldName ?? "",
|
|
1756
|
+
secretPreserveOnEmpty: result.secretPreserveOnEmpty === undefined ? "" : String(result.secretPreserveOnEmpty),
|
|
1833
1757
|
secretStateFieldName: result.secretStateFieldName ?? ""
|
|
1834
1758
|
}),
|
|
1835
1759
|
missingNameMessage: REST_RESOURCE_MISSING_NAME_MESSAGE,
|
|
@@ -1839,7 +1763,7 @@ var restResourceAddKindEntry = defineAddKindRegistryEntry({
|
|
|
1839
1763
|
},
|
|
1840
1764
|
sortOrder: 80,
|
|
1841
1765
|
supportsDryRun: true,
|
|
1842
|
-
usage:
|
|
1766
|
+
usage: REST_RESOURCE_USAGE,
|
|
1843
1767
|
visibleFieldNames: () => NAME_NAMESPACE_METHODS_VISIBLE_FIELDS
|
|
1844
1768
|
});
|
|
1845
1769
|
|
|
@@ -2368,6 +2292,101 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
2368
2292
|
}
|
|
2369
2293
|
};
|
|
2370
2294
|
}
|
|
2295
|
+
// package.json
|
|
2296
|
+
var package_default = {
|
|
2297
|
+
name: "wp-typia",
|
|
2298
|
+
version: "0.23.1",
|
|
2299
|
+
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
2300
|
+
packageManager: "bun@1.3.11",
|
|
2301
|
+
type: "module",
|
|
2302
|
+
bin: {
|
|
2303
|
+
"wp-typia": "bin/wp-typia.js"
|
|
2304
|
+
},
|
|
2305
|
+
files: [
|
|
2306
|
+
"bin/",
|
|
2307
|
+
"dist-bunli/",
|
|
2308
|
+
"README.md",
|
|
2309
|
+
"package.json"
|
|
2310
|
+
],
|
|
2311
|
+
scripts: {
|
|
2312
|
+
"generate:routing": "node scripts/generate-routing-metadata.mjs",
|
|
2313
|
+
"validate:routing": "node scripts/generate-routing-metadata.mjs --check",
|
|
2314
|
+
generate: "node scripts/generate-routing-metadata.mjs && bun scripts/generate-bunli-metadata.ts",
|
|
2315
|
+
build: "bun run generate && bun scripts/build-bunli-runtime.ts",
|
|
2316
|
+
"build:standalone": "bun scripts/build-standalone-runtime.ts --targets native --outdir ./dist-standalone",
|
|
2317
|
+
"build:standalone:release": "bun scripts/build-standalone-runtime.ts --targets darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 --outdir ./.cache/standalone/raw",
|
|
2318
|
+
"bunli:generate": "bun run generate",
|
|
2319
|
+
"bunli:build": "bun run build",
|
|
2320
|
+
"bunli:dev": "bun src/cli.ts",
|
|
2321
|
+
"bunli:test": "bun test tests/*.test.ts",
|
|
2322
|
+
dev: "bun run build && node bin/wp-typia.js",
|
|
2323
|
+
"standalone:prepare-release-assets": "bun scripts/prepare-standalone-release-assets.ts --input-dir ./.cache/standalone/raw --outdir ./.cache/standalone/release-assets",
|
|
2324
|
+
test: "cd ../wp-typia-project-tools && bun run build && cd ../wp-typia && bun run build && bun test tests/*.test.ts",
|
|
2325
|
+
"test:coverage": "cd ../wp-typia-project-tools && bun run build && cd ../wp-typia && bun run build && bun test tests/*.test.ts --coverage --coverage-reporter=lcov --coverage-dir=coverage",
|
|
2326
|
+
clean: "rm -rf .bunli .cache/standalone .pack-backup dist-bunli dist-standalone",
|
|
2327
|
+
prepack: "bun run build && node ./scripts/publish-runtime-maps.mjs prepare",
|
|
2328
|
+
postpack: "node ./scripts/publish-runtime-maps.mjs restore"
|
|
2329
|
+
},
|
|
2330
|
+
keywords: [
|
|
2331
|
+
"wordpress",
|
|
2332
|
+
"gutenberg",
|
|
2333
|
+
"typia",
|
|
2334
|
+
"cli",
|
|
2335
|
+
"scaffold",
|
|
2336
|
+
"templates"
|
|
2337
|
+
],
|
|
2338
|
+
author: "imjlk",
|
|
2339
|
+
license: "GPL-2.0-or-later",
|
|
2340
|
+
repository: {
|
|
2341
|
+
type: "git",
|
|
2342
|
+
url: "git+https://github.com/imjlk/wp-typia.git",
|
|
2343
|
+
directory: "packages/wp-typia"
|
|
2344
|
+
},
|
|
2345
|
+
bugs: {
|
|
2346
|
+
url: "https://github.com/imjlk/wp-typia/issues"
|
|
2347
|
+
},
|
|
2348
|
+
homepage: "https://github.com/imjlk/wp-typia/tree/main/packages/wp-typia#readme",
|
|
2349
|
+
publishConfig: {
|
|
2350
|
+
access: "public"
|
|
2351
|
+
},
|
|
2352
|
+
engines: {
|
|
2353
|
+
bun: ">=1.3.11",
|
|
2354
|
+
node: ">=20.0.0",
|
|
2355
|
+
npm: ">=10.0.0"
|
|
2356
|
+
},
|
|
2357
|
+
dependencies: {
|
|
2358
|
+
"@bunli/core": "0.9.0",
|
|
2359
|
+
"@bunli/plugin-ai-detect": "0.6.4",
|
|
2360
|
+
"@bunli/plugin-completions": "0.3.5",
|
|
2361
|
+
"@bunli/plugin-config": "0.4.4",
|
|
2362
|
+
"@bunli/plugin-mcp": "0.2.5",
|
|
2363
|
+
"@bunli/plugin-skills": "0.1.0",
|
|
2364
|
+
"@bunli/runtime": "0.3.1",
|
|
2365
|
+
"@bunli/tui": "0.6.0",
|
|
2366
|
+
"@bunli/utils": "0.6.0",
|
|
2367
|
+
"@wp-typia/api-client": "^0.4.5",
|
|
2368
|
+
"@wp-typia/project-tools": "0.23.1",
|
|
2369
|
+
"better-result": "^2.7.0",
|
|
2370
|
+
react: "^19.2.5",
|
|
2371
|
+
"react-dom": "^19.2.5",
|
|
2372
|
+
zod: "4.3.6"
|
|
2373
|
+
},
|
|
2374
|
+
devDependencies: {
|
|
2375
|
+
"@bunli/generator": "0.6.5",
|
|
2376
|
+
"@bunli/test": "0.6.0",
|
|
2377
|
+
bunli: "0.9.0",
|
|
2378
|
+
typescript: "^5.9.2"
|
|
2379
|
+
},
|
|
2380
|
+
optionalDependencies: {
|
|
2381
|
+
"@opentui/core-darwin-arm64": "0.1.97",
|
|
2382
|
+
"@opentui/core-darwin-x64": "0.1.97",
|
|
2383
|
+
"@opentui/core-linux-arm64": "0.1.97",
|
|
2384
|
+
"@opentui/core-linux-x64": "0.1.97",
|
|
2385
|
+
"@opentui/core-win32-arm64": "0.1.97",
|
|
2386
|
+
"@opentui/core-win32-x64": "0.1.97"
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2371
2390
|
// src/runtime-output/create.ts
|
|
2372
2391
|
import {
|
|
2373
2392
|
PACKAGE_MANAGER_IDS,
|
|
@@ -2555,8 +2574,8 @@ function isInteractiveTerminal({
|
|
|
2555
2574
|
// src/runtime-bridge-shared.ts
|
|
2556
2575
|
var loadCliDiagnosticsRuntime = () => import("@wp-typia/project-tools/cli-diagnostics");
|
|
2557
2576
|
async function wrapCliCommandError(command, error) {
|
|
2558
|
-
const { createCliCommandError:
|
|
2559
|
-
return
|
|
2577
|
+
const { createCliCommandError: createCliCommandError2 } = await loadCliDiagnosticsRuntime();
|
|
2578
|
+
return createCliCommandError2({ command, error });
|
|
2560
2579
|
}
|
|
2561
2580
|
function shouldWrapCliCommandError(options) {
|
|
2562
2581
|
if (options.emitOutput === false) {
|
|
@@ -2768,6 +2787,7 @@ async function executeCreateCommand({
|
|
|
2768
2787
|
packageManager: readOptionalLooseStringFlag(flags, "package-manager"),
|
|
2769
2788
|
persistencePolicy: readOptionalLooseStringFlag(flags, "persistence-policy"),
|
|
2770
2789
|
phpPrefix: readOptionalLooseStringFlag(flags, "php-prefix"),
|
|
2790
|
+
profile: readOptionalLooseStringFlag(flags, "profile"),
|
|
2771
2791
|
projectInput: projectDir,
|
|
2772
2792
|
onProgress: async (progress) => {
|
|
2773
2793
|
const payload2 = {
|
|
@@ -2817,10 +2837,10 @@ async function executeCreateCommand({
|
|
|
2817
2837
|
}
|
|
2818
2838
|
// src/runtime-bridge-doctor.ts
|
|
2819
2839
|
var loadCliDoctorRuntime = () => import("@wp-typia/project-tools/cli-doctor");
|
|
2820
|
-
async function executeDoctorCommand(cwd) {
|
|
2840
|
+
async function executeDoctorCommand(cwd, options = {}) {
|
|
2821
2841
|
try {
|
|
2822
2842
|
const { runDoctor } = await loadCliDoctorRuntime();
|
|
2823
|
-
await runDoctor(cwd);
|
|
2843
|
+
await runDoctor(cwd, { exitPolicy: options.exitPolicy });
|
|
2824
2844
|
} catch (error) {
|
|
2825
2845
|
throw await wrapCliCommandError("doctor", error);
|
|
2826
2846
|
}
|
|
@@ -3470,9 +3490,48 @@ function normalizeWpTypiaArgv(argv) {
|
|
|
3470
3490
|
return normalizedArgv;
|
|
3471
3491
|
}
|
|
3472
3492
|
|
|
3473
|
-
// src/node-fallback/
|
|
3493
|
+
// src/node-fallback/doctor.ts
|
|
3474
3494
|
import {
|
|
3475
3495
|
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES11,
|
|
3496
|
+
createCliCommandError as createCliCommandError2
|
|
3497
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3498
|
+
async function renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine) {
|
|
3499
|
+
const {
|
|
3500
|
+
createDoctorRunSummary,
|
|
3501
|
+
getDoctorChecks,
|
|
3502
|
+
getDoctorExitFailureDetailLines
|
|
3503
|
+
} = await import("@wp-typia/project-tools/cli-doctor");
|
|
3504
|
+
const checks = await getDoctorChecks(cwd);
|
|
3505
|
+
const summary = createDoctorRunSummary(checks, { exitPolicy });
|
|
3506
|
+
printLine(JSON.stringify({
|
|
3507
|
+
checks,
|
|
3508
|
+
summary
|
|
3509
|
+
}, null, 2));
|
|
3510
|
+
if (summary.exitCode === 1) {
|
|
3511
|
+
throw createCliCommandError2({
|
|
3512
|
+
code: CLI_DIAGNOSTIC_CODES11.DOCTOR_CHECK_FAILED,
|
|
3513
|
+
command: "doctor",
|
|
3514
|
+
detailLines: getDoctorExitFailureDetailLines(checks, { exitPolicy }),
|
|
3515
|
+
summary: "One or more doctor checks failed."
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
async function dispatchNodeFallbackDoctor({
|
|
3520
|
+
cwd,
|
|
3521
|
+
mergedFlags,
|
|
3522
|
+
printLine
|
|
3523
|
+
}) {
|
|
3524
|
+
const exitPolicy = mergedFlags["workspace-only"] ? "workspace-only" : "strict";
|
|
3525
|
+
if (mergedFlags.format === "json") {
|
|
3526
|
+
await renderNodeFallbackDoctorJson(cwd, exitPolicy, printLine);
|
|
3527
|
+
return;
|
|
3528
|
+
}
|
|
3529
|
+
await executeDoctorCommand(cwd, { exitPolicy });
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
// src/node-fallback/dispatchers/add.ts
|
|
3533
|
+
import {
|
|
3534
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES12,
|
|
3476
3535
|
createCliCommandError as createCliCommandError3
|
|
3477
3536
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3478
3537
|
async function dispatchNodeFallbackAdd({
|
|
@@ -3488,7 +3547,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3488
3547
|
printLine(formatAddHelpText());
|
|
3489
3548
|
}
|
|
3490
3549
|
throw createCliCommandError3({
|
|
3491
|
-
code:
|
|
3550
|
+
code: CLI_DIAGNOSTIC_CODES12.MISSING_ARGUMENT,
|
|
3492
3551
|
command: "add",
|
|
3493
3552
|
detailLines: buildMissingAddKindDetailLines()
|
|
3494
3553
|
});
|
|
@@ -3533,7 +3592,7 @@ async function dispatchNodeFallbackAdd({
|
|
|
3533
3592
|
|
|
3534
3593
|
// src/node-fallback/dispatchers/create.ts
|
|
3535
3594
|
import {
|
|
3536
|
-
CLI_DIAGNOSTIC_CODES as
|
|
3595
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES13,
|
|
3537
3596
|
createCliCommandError as createCliCommandError4
|
|
3538
3597
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3539
3598
|
async function dispatchNodeFallbackCreate({
|
|
@@ -3546,7 +3605,7 @@ async function dispatchNodeFallbackCreate({
|
|
|
3546
3605
|
const projectDir = positionals[1];
|
|
3547
3606
|
if (!projectDir) {
|
|
3548
3607
|
throw createCliCommandError4({
|
|
3549
|
-
code:
|
|
3608
|
+
code: CLI_DIAGNOSTIC_CODES13.MISSING_ARGUMENT,
|
|
3550
3609
|
command: "create",
|
|
3551
3610
|
detailLines: buildMissingCreateProjectDirDetailLines()
|
|
3552
3611
|
});
|
|
@@ -3577,6 +3636,39 @@ async function dispatchNodeFallbackCreate({
|
|
|
3577
3636
|
}
|
|
3578
3637
|
}
|
|
3579
3638
|
|
|
3639
|
+
// src/node-fallback/errors.ts
|
|
3640
|
+
import {
|
|
3641
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES14,
|
|
3642
|
+
createCliCommandError as createCliCommandError6,
|
|
3643
|
+
formatCliDiagnosticError,
|
|
3644
|
+
isCliDiagnosticError,
|
|
3645
|
+
serializeCliDiagnosticError as serializeCliDiagnosticError2
|
|
3646
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3647
|
+
|
|
3648
|
+
// src/cli-diagnostic-output.ts
|
|
3649
|
+
import {
|
|
3650
|
+
createCliCommandError as createCliCommandError5,
|
|
3651
|
+
serializeCliDiagnosticError
|
|
3652
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3653
|
+
function prefersStructuredCliArgv(argv) {
|
|
3654
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
3655
|
+
const arg = argv[index];
|
|
3656
|
+
if (!arg) {
|
|
3657
|
+
continue;
|
|
3658
|
+
}
|
|
3659
|
+
if (arg === "--") {
|
|
3660
|
+
return false;
|
|
3661
|
+
}
|
|
3662
|
+
if (arg === "--format") {
|
|
3663
|
+
return argv[index + 1] === "json";
|
|
3664
|
+
}
|
|
3665
|
+
if (arg.startsWith("--format=")) {
|
|
3666
|
+
return arg.slice("--format=".length) === "json";
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
return false;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3580
3672
|
// src/node-fallback/help.ts
|
|
3581
3673
|
var STANDALONE_GUIDANCE_LINE = "Prefer not to install Bun? Use the standalone wp-typia binary from the GitHub release assets.";
|
|
3582
3674
|
var NODE_FALLBACK_RUNTIME_SUMMARY_LINES = [
|
|
@@ -3631,9 +3723,9 @@ var NODE_FALLBACK_COMMAND_HELP_CONFIG = {
|
|
|
3631
3723
|
},
|
|
3632
3724
|
doctor: {
|
|
3633
3725
|
bodyLines: [
|
|
3634
|
-
"Runs read-only environment readiness checks. Official wp-typia workspace roots also get inventory, source-tree drift, iframe/API v3 compatibility, and shared convention checks."
|
|
3726
|
+
"Runs read-only environment readiness checks. Official wp-typia workspace roots also get inventory, source-tree drift, iframe/API v3 compatibility, and shared convention checks. Use --workspace-only for CI gates that should fail only on workspace-scoped checks while keeping environment failures advisory."
|
|
3635
3727
|
],
|
|
3636
|
-
heading: "Usage: wp-typia doctor [--format json]",
|
|
3728
|
+
heading: "Usage: wp-typia doctor [--format json] [--workspace-only]",
|
|
3637
3729
|
optionMetadata: DOCTOR_OPTION_METADATA
|
|
3638
3730
|
},
|
|
3639
3731
|
init: {
|
|
@@ -3661,6 +3753,138 @@ var NODE_FALLBACK_HELP_RENDERERS = Object.fromEntries(Object.entries(NODE_FALLBA
|
|
|
3661
3753
|
(printLine) => renderNodeFallbackCommandHelp(printLine, config)
|
|
3662
3754
|
]));
|
|
3663
3755
|
|
|
3756
|
+
// src/node-fallback/errors.ts
|
|
3757
|
+
function createNodeFallbackNoCommandCliError() {
|
|
3758
|
+
return createCliCommandError6({
|
|
3759
|
+
code: CLI_DIAGNOSTIC_CODES14.INVALID_COMMAND,
|
|
3760
|
+
command: "wp-typia",
|
|
3761
|
+
detailLines: [NODE_FALLBACK_NO_COMMAND_REASON_LINE],
|
|
3762
|
+
summary: "No command was provided."
|
|
3763
|
+
});
|
|
3764
|
+
}
|
|
3765
|
+
function isNodeFallbackNoCommandCliDiagnostic(error) {
|
|
3766
|
+
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES14.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(NODE_FALLBACK_NO_COMMAND_REASON_LINE);
|
|
3767
|
+
}
|
|
3768
|
+
function throwUnsupportedNodeFallbackCommand(command) {
|
|
3769
|
+
throw createCliCommandError6({
|
|
3770
|
+
code: CLI_DIAGNOSTIC_CODES14.UNSUPPORTED_COMMAND,
|
|
3771
|
+
command,
|
|
3772
|
+
detailLines: [
|
|
3773
|
+
[
|
|
3774
|
+
`The Bun-free fallback runtime does not support \`${command}\` yet.`,
|
|
3775
|
+
"Supported without Bun: `--version`, `--help`, non-interactive `create`/`init`/`add`/`migrate`, `doctor`, `sync`, `templates list`, and `templates inspect`.",
|
|
3776
|
+
`Install Bun 1.3.11+ or use \`bunx wp-typia ...\` for the full Bunli-powered runtime. ${STANDALONE_GUIDANCE_LINE}`
|
|
3777
|
+
].join(" ")
|
|
3778
|
+
],
|
|
3779
|
+
summary: "This command requires the Bun-powered runtime."
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
async function handleNodeFallbackEntrypointError(error, argv) {
|
|
3783
|
+
if (prefersStructuredCliArgv(argv)) {
|
|
3784
|
+
const diagnostic = createCliCommandError6({
|
|
3785
|
+
command: resolveCanonicalCommandContext(argv),
|
|
3786
|
+
error
|
|
3787
|
+
});
|
|
3788
|
+
process.stderr.write(`${JSON.stringify({
|
|
3789
|
+
ok: false,
|
|
3790
|
+
error: serializeCliDiagnosticError2(diagnostic)
|
|
3791
|
+
}, null, 2)}
|
|
3792
|
+
`);
|
|
3793
|
+
process.exitCode = 1;
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (isNodeFallbackNoCommandCliDiagnostic(error)) {
|
|
3797
|
+
process.exitCode = 1;
|
|
3798
|
+
return;
|
|
3799
|
+
}
|
|
3800
|
+
console.error(`Error: ${await formatCliDiagnosticError(error)}`);
|
|
3801
|
+
process.exitCode = 1;
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
// src/node-fallback/templates.ts
|
|
3805
|
+
import {
|
|
3806
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES15,
|
|
3807
|
+
createCliCommandError as createCliCommandError7
|
|
3808
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
3809
|
+
import {
|
|
3810
|
+
getTemplateById,
|
|
3811
|
+
listTemplates
|
|
3812
|
+
} from "@wp-typia/project-tools/cli-templates";
|
|
3813
|
+
function renderNodeFallbackTemplatesJson(printLine, flags, subcommand) {
|
|
3814
|
+
if (subcommand === "list") {
|
|
3815
|
+
printLine(JSON.stringify({
|
|
3816
|
+
templates: listTemplates()
|
|
3817
|
+
}, null, 2));
|
|
3818
|
+
return;
|
|
3819
|
+
}
|
|
3820
|
+
const templateId = flags.id;
|
|
3821
|
+
if (!templateId) {
|
|
3822
|
+
throw createCliCommandError7({
|
|
3823
|
+
code: CLI_DIAGNOSTIC_CODES15.MISSING_ARGUMENT,
|
|
3824
|
+
command: "templates",
|
|
3825
|
+
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
const template = getTemplateById(templateId);
|
|
3829
|
+
if (!template) {
|
|
3830
|
+
throw createCliCommandError7({
|
|
3831
|
+
code: CLI_DIAGNOSTIC_CODES15.INVALID_ARGUMENT,
|
|
3832
|
+
command: "templates",
|
|
3833
|
+
detailLines: [`Unknown template "${templateId}".`]
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
printLine(JSON.stringify({
|
|
3837
|
+
template
|
|
3838
|
+
}, null, 2));
|
|
3839
|
+
}
|
|
3840
|
+
async function dispatchNodeFallbackTemplates({
|
|
3841
|
+
mergedFlags,
|
|
3842
|
+
positionals,
|
|
3843
|
+
printLine
|
|
3844
|
+
}) {
|
|
3845
|
+
const subcommand = positionals[1];
|
|
3846
|
+
const templateId = typeof mergedFlags.id === "string" ? mergedFlags.id : positionals[2];
|
|
3847
|
+
const resolvedSubcommand = subcommand ?? (templateId ? "inspect" : "list");
|
|
3848
|
+
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3849
|
+
throw createCliCommandError7({
|
|
3850
|
+
code: CLI_DIAGNOSTIC_CODES15.INVALID_COMMAND,
|
|
3851
|
+
command: "templates",
|
|
3852
|
+
detailLines: [
|
|
3853
|
+
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
3854
|
+
]
|
|
3855
|
+
});
|
|
3856
|
+
}
|
|
3857
|
+
if (mergedFlags.format === "json") {
|
|
3858
|
+
renderNodeFallbackTemplatesJson(printLine, {
|
|
3859
|
+
format: mergedFlags.format,
|
|
3860
|
+
id: templateId
|
|
3861
|
+
}, resolvedSubcommand);
|
|
3862
|
+
return;
|
|
3863
|
+
}
|
|
3864
|
+
await executeTemplatesCommand({
|
|
3865
|
+
flags: {
|
|
3866
|
+
id: templateId,
|
|
3867
|
+
subcommand: resolvedSubcommand
|
|
3868
|
+
}
|
|
3869
|
+
}, printLine);
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
// src/node-fallback/version.ts
|
|
3873
|
+
function renderNodeFallbackVersion(printLine, options = {}) {
|
|
3874
|
+
if (options.format === "json") {
|
|
3875
|
+
printLine(JSON.stringify({
|
|
3876
|
+
ok: true,
|
|
3877
|
+
data: {
|
|
3878
|
+
type: "version",
|
|
3879
|
+
name: package_default.name,
|
|
3880
|
+
version: package_default.version
|
|
3881
|
+
}
|
|
3882
|
+
}, null, 2));
|
|
3883
|
+
return;
|
|
3884
|
+
}
|
|
3885
|
+
printLine(`wp-typia ${package_default.version}`);
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3664
3888
|
// src/node-cli.ts
|
|
3665
3889
|
var NODE_FALLBACK_OPTION_PARSER = buildCommandOptionParser(ALL_COMMAND_OPTION_METADATA);
|
|
3666
3890
|
var NODE_FALLBACK_BOOLEAN_OPTION_NAMES = ["help", "version"];
|
|
@@ -3670,17 +3894,6 @@ var printLine = (line) => {
|
|
|
3670
3894
|
var warnLine = (line) => {
|
|
3671
3895
|
console.warn(line);
|
|
3672
3896
|
};
|
|
3673
|
-
function createNoCommandCliError() {
|
|
3674
|
-
return createCliCommandError5({
|
|
3675
|
-
code: CLI_DIAGNOSTIC_CODES13.INVALID_COMMAND,
|
|
3676
|
-
command: "wp-typia",
|
|
3677
|
-
detailLines: [NODE_FALLBACK_NO_COMMAND_REASON_LINE],
|
|
3678
|
-
summary: "No command was provided."
|
|
3679
|
-
});
|
|
3680
|
-
}
|
|
3681
|
-
function isNoCommandCliDiagnostic(error) {
|
|
3682
|
-
return isCliDiagnosticError(error) && error.code === CLI_DIAGNOSTIC_CODES13.INVALID_COMMAND && error.command === "wp-typia" && error.detailLines.includes(NODE_FALLBACK_NO_COMMAND_REASON_LINE);
|
|
3683
|
-
}
|
|
3684
3897
|
function hasFlagBeforeTerminator(argv, flag) {
|
|
3685
3898
|
for (const arg of argv) {
|
|
3686
3899
|
if (arg === "--") {
|
|
@@ -3737,92 +3950,10 @@ function parseArgv(argv) {
|
|
|
3737
3950
|
parser: NODE_FALLBACK_OPTION_PARSER
|
|
3738
3951
|
});
|
|
3739
3952
|
}
|
|
3740
|
-
function renderVersion(options = {}) {
|
|
3741
|
-
if (options.format === "json") {
|
|
3742
|
-
printLine(JSON.stringify({
|
|
3743
|
-
ok: true,
|
|
3744
|
-
data: {
|
|
3745
|
-
type: "version",
|
|
3746
|
-
name: package_default.name,
|
|
3747
|
-
version: package_default.version
|
|
3748
|
-
}
|
|
3749
|
-
}, null, 2));
|
|
3750
|
-
return;
|
|
3751
|
-
}
|
|
3752
|
-
printLine(`wp-typia ${package_default.version}`);
|
|
3753
|
-
}
|
|
3754
|
-
function renderTemplatesJson(flags, subcommand) {
|
|
3755
|
-
if (subcommand === "list") {
|
|
3756
|
-
printLine(JSON.stringify({
|
|
3757
|
-
templates: listTemplates()
|
|
3758
|
-
}, null, 2));
|
|
3759
|
-
return;
|
|
3760
|
-
}
|
|
3761
|
-
const templateId = flags.id;
|
|
3762
|
-
if (!templateId) {
|
|
3763
|
-
throw createCliCommandError5({
|
|
3764
|
-
code: CLI_DIAGNOSTIC_CODES13.MISSING_ARGUMENT,
|
|
3765
|
-
command: "templates",
|
|
3766
|
-
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
3767
|
-
});
|
|
3768
|
-
}
|
|
3769
|
-
const template = getTemplateById(templateId);
|
|
3770
|
-
if (!template) {
|
|
3771
|
-
throw createCliCommandError5({
|
|
3772
|
-
code: CLI_DIAGNOSTIC_CODES13.INVALID_ARGUMENT,
|
|
3773
|
-
command: "templates",
|
|
3774
|
-
detailLines: [`Unknown template "${templateId}".`]
|
|
3775
|
-
});
|
|
3776
|
-
}
|
|
3777
|
-
printLine(JSON.stringify({
|
|
3778
|
-
template
|
|
3779
|
-
}, null, 2));
|
|
3780
|
-
}
|
|
3781
|
-
function renderUnsupportedCommand(command) {
|
|
3782
|
-
throw createCliCommandError5({
|
|
3783
|
-
code: CLI_DIAGNOSTIC_CODES13.UNSUPPORTED_COMMAND,
|
|
3784
|
-
command,
|
|
3785
|
-
detailLines: [
|
|
3786
|
-
[
|
|
3787
|
-
`The Bun-free fallback runtime does not support \`${command}\` yet.`,
|
|
3788
|
-
"Supported without Bun: `--version`, `--help`, non-interactive `create`/`init`/`add`/`migrate`, `doctor`, `sync`, `templates list`, and `templates inspect`.",
|
|
3789
|
-
`Install Bun 1.3.11+ or use \`bunx wp-typia ...\` for the full Bunli-powered runtime. ${STANDALONE_GUIDANCE_LINE}`
|
|
3790
|
-
].join(" ")
|
|
3791
|
-
],
|
|
3792
|
-
summary: "This command requires the Bun-powered runtime."
|
|
3793
|
-
});
|
|
3794
|
-
}
|
|
3795
|
-
async function renderDoctorJson() {
|
|
3796
|
-
const [
|
|
3797
|
-
{ getDoctorChecks },
|
|
3798
|
-
{ createCliCommandError: createCliCommandError6, getDoctorFailureDetailLines }
|
|
3799
|
-
] = await Promise.all([
|
|
3800
|
-
import("@wp-typia/project-tools/cli-doctor"),
|
|
3801
|
-
import("@wp-typia/project-tools/cli-diagnostics")
|
|
3802
|
-
]);
|
|
3803
|
-
const checks = await getDoctorChecks(process.cwd());
|
|
3804
|
-
printLine(JSON.stringify({
|
|
3805
|
-
checks
|
|
3806
|
-
}, null, 2));
|
|
3807
|
-
if (checks.some((check) => check.status === "fail")) {
|
|
3808
|
-
throw createCliCommandError6({
|
|
3809
|
-
code: CLI_DIAGNOSTIC_CODES13.DOCTOR_CHECK_FAILED,
|
|
3810
|
-
command: "doctor",
|
|
3811
|
-
detailLines: getDoctorFailureDetailLines(checks),
|
|
3812
|
-
summary: "One or more doctor checks failed."
|
|
3813
|
-
});
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
3953
|
var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
3817
3954
|
add: dispatchNodeFallbackAdd,
|
|
3818
3955
|
create: dispatchNodeFallbackCreate,
|
|
3819
|
-
doctor:
|
|
3820
|
-
if (mergedFlags.format === "json") {
|
|
3821
|
-
await renderDoctorJson();
|
|
3822
|
-
return;
|
|
3823
|
-
}
|
|
3824
|
-
await executeDoctorCommand(cwd);
|
|
3825
|
-
},
|
|
3956
|
+
doctor: dispatchNodeFallbackDoctor,
|
|
3826
3957
|
init: async ({
|
|
3827
3958
|
cwd,
|
|
3828
3959
|
mergedFlags,
|
|
@@ -3892,43 +4023,13 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3892
4023
|
});
|
|
3893
4024
|
}
|
|
3894
4025
|
} catch (error) {
|
|
3895
|
-
throw
|
|
4026
|
+
throw createCliCommandError8({
|
|
3896
4027
|
command: "sync",
|
|
3897
4028
|
error
|
|
3898
4029
|
});
|
|
3899
4030
|
}
|
|
3900
4031
|
},
|
|
3901
|
-
templates:
|
|
3902
|
-
mergedFlags,
|
|
3903
|
-
positionals,
|
|
3904
|
-
printLine: printLine2
|
|
3905
|
-
}) => {
|
|
3906
|
-
const subcommand = positionals[1];
|
|
3907
|
-
const templateId = typeof mergedFlags.id === "string" ? mergedFlags.id : positionals[2];
|
|
3908
|
-
const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
|
|
3909
|
-
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3910
|
-
throw createCliCommandError5({
|
|
3911
|
-
code: CLI_DIAGNOSTIC_CODES13.INVALID_COMMAND,
|
|
3912
|
-
command: "templates",
|
|
3913
|
-
detailLines: [
|
|
3914
|
-
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
3915
|
-
]
|
|
3916
|
-
});
|
|
3917
|
-
}
|
|
3918
|
-
if (mergedFlags.format === "json") {
|
|
3919
|
-
renderTemplatesJson({
|
|
3920
|
-
format: mergedFlags.format,
|
|
3921
|
-
id: templateId
|
|
3922
|
-
}, resolvedSubcommand);
|
|
3923
|
-
return;
|
|
3924
|
-
}
|
|
3925
|
-
await executeTemplatesCommand({
|
|
3926
|
-
flags: {
|
|
3927
|
-
id: templateId,
|
|
3928
|
-
subcommand: resolvedSubcommand
|
|
3929
|
-
}
|
|
3930
|
-
}, printLine2);
|
|
3931
|
-
}
|
|
4032
|
+
templates: dispatchNodeFallbackTemplates
|
|
3932
4033
|
};
|
|
3933
4034
|
async function runNodeCli(argv = process.argv.slice(2)) {
|
|
3934
4035
|
const normalizedArgv = normalizeWpTypiaArgv(argv);
|
|
@@ -3946,7 +4047,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
3946
4047
|
const helpTarget = command === "help" ? subcommand : command;
|
|
3947
4048
|
const versionRequested = hasFlagBeforeTerminator(cliArgv, "--version") || command === "version";
|
|
3948
4049
|
if (cliArgv.length === 0) {
|
|
3949
|
-
const noCommandError =
|
|
4050
|
+
const noCommandError = createNodeFallbackNoCommandCliError();
|
|
3950
4051
|
if (rawMergedFlags.format !== "json") {
|
|
3951
4052
|
renderNoCommandHelp(printLine);
|
|
3952
4053
|
}
|
|
@@ -3971,7 +4072,7 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
3971
4072
|
return;
|
|
3972
4073
|
}
|
|
3973
4074
|
if (versionRequested) {
|
|
3974
|
-
|
|
4075
|
+
renderNodeFallbackVersion(printLine, {
|
|
3975
4076
|
format: typeof rawMergedFlags.format === "string" ? rawMergedFlags.format : undefined
|
|
3976
4077
|
});
|
|
3977
4078
|
return;
|
|
@@ -3988,32 +4089,13 @@ async function runNodeCli(argv = process.argv.slice(2)) {
|
|
|
3988
4089
|
});
|
|
3989
4090
|
return;
|
|
3990
4091
|
}
|
|
3991
|
-
|
|
4092
|
+
throwUnsupportedNodeFallbackCommand(command ?? "(missing)");
|
|
3992
4093
|
}
|
|
3993
4094
|
async function runNodeCliEntrypoint(argv = process.argv.slice(2)) {
|
|
3994
|
-
const prefersStructuredErrorOutput = prefersStructuredCliArgv(argv);
|
|
3995
4095
|
try {
|
|
3996
4096
|
await runNodeCli(argv);
|
|
3997
4097
|
} catch (error) {
|
|
3998
|
-
|
|
3999
|
-
const diagnostic = createCliCommandError5({
|
|
4000
|
-
command: resolveCanonicalCommandContext(argv),
|
|
4001
|
-
error
|
|
4002
|
-
});
|
|
4003
|
-
process.stderr.write(`${JSON.stringify({
|
|
4004
|
-
ok: false,
|
|
4005
|
-
error: serializeCliDiagnosticError2(diagnostic)
|
|
4006
|
-
}, null, 2)}
|
|
4007
|
-
`);
|
|
4008
|
-
process.exitCode = 1;
|
|
4009
|
-
return;
|
|
4010
|
-
}
|
|
4011
|
-
if (isNoCommandCliDiagnostic(error)) {
|
|
4012
|
-
process.exitCode = 1;
|
|
4013
|
-
return;
|
|
4014
|
-
}
|
|
4015
|
-
console.error(`Error: ${await formatCliDiagnosticError(error)}`);
|
|
4016
|
-
process.exitCode = 1;
|
|
4098
|
+
await handleNodeFallbackEntrypointError(error, argv);
|
|
4017
4099
|
}
|
|
4018
4100
|
}
|
|
4019
4101
|
export {
|
|
@@ -4023,4 +4105,4 @@ export {
|
|
|
4023
4105
|
hasFlagBeforeTerminator
|
|
4024
4106
|
};
|
|
4025
4107
|
|
|
4026
|
-
//# debugId=
|
|
4108
|
+
//# debugId=7520561D7D1BD35A64756E2164756E21
|