wp-typia 0.22.3 → 0.22.5
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/dist-bunli/.bunli/commands.gen.js +2098 -2027
- package/dist-bunli/{cli-sj5mtyzj.js → cli-6bhfzq5e.js} +41 -2
- package/dist-bunli/{cli-add-p3re8act.js → cli-add-1gqgshf0.js} +211 -395
- package/dist-bunli/{cli-pd5pqgre.js → cli-btbpt84c.js} +6 -11
- package/dist-bunli/{cli-tbd9x8b6.js → cli-ctddkm3n.js} +138 -12
- package/dist-bunli/{cli-doctor-cjm4rzbk.js → cli-doctor-w35s8y9w.js} +9 -64
- package/dist-bunli/{cli-gcbre1zs.js → cli-hb9vpsev.js} +6 -13
- package/dist-bunli/{cli-init-7gcthyn1.js → cli-init-z8sjmkvc.js} +11 -11
- package/dist-bunli/{cli-x0h03qqe.js → cli-j30rk466.js} +1406 -1304
- package/dist-bunli/{cli-mpgt29xc.js → cli-nzwpmw4y.js} +124 -38
- package/dist-bunli/cli-rwjkqjhs.js +88 -0
- package/dist-bunli/{cli-scaffold-x1dp8sz1.js → cli-scaffold-ad3bd555.js} +10 -10
- package/dist-bunli/{cli-prc42zqd.js → cli-xbzfx7qz.js} +7 -7
- package/dist-bunli/cli.js +7 -4
- package/dist-bunli/{command-list-wzej5c7v.js → command-list-scd6zqp8.js} +69 -132
- package/dist-bunli/{migrations-xfb2h7nf.js → migrations-skkzdvhm.js} +5 -5
- package/dist-bunli/node-cli.js +199 -221
- package/dist-bunli/{workspace-project-gxb499cp.js → workspace-project-7826tewa.js} +3 -2
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -3,7 +3,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "wp-typia",
|
|
6
|
-
version: "0.22.
|
|
6
|
+
version: "0.22.5",
|
|
7
7
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
8
8
|
packageManager: "bun@1.3.11",
|
|
9
9
|
type: "module",
|
|
@@ -73,7 +73,7 @@ var package_default = {
|
|
|
73
73
|
"@bunli/tui": "0.6.0",
|
|
74
74
|
"@bunli/utils": "0.6.0",
|
|
75
75
|
"@wp-typia/api-client": "^0.4.5",
|
|
76
|
-
"@wp-typia/project-tools": "0.22.
|
|
76
|
+
"@wp-typia/project-tools": "0.22.5",
|
|
77
77
|
"better-result": "^2.7.0",
|
|
78
78
|
react: "^19.2.5",
|
|
79
79
|
"react-dom": "^19.2.5",
|
|
@@ -97,8 +97,8 @@ var package_default = {
|
|
|
97
97
|
|
|
98
98
|
// src/node-cli.ts
|
|
99
99
|
import {
|
|
100
|
-
CLI_DIAGNOSTIC_CODES as
|
|
101
|
-
createCliCommandError as
|
|
100
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
101
|
+
createCliCommandError as createCliCommandError3,
|
|
102
102
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError6,
|
|
103
103
|
formatCliDiagnosticError,
|
|
104
104
|
serializeCliDiagnosticError as serializeCliDiagnosticError2
|
|
@@ -336,7 +336,7 @@ var SYNC_OPTION_METADATA = {
|
|
|
336
336
|
};
|
|
337
337
|
var DOCTOR_OPTION_METADATA = {
|
|
338
338
|
format: {
|
|
339
|
-
description: "Use `json` for machine-readable doctor check output.",
|
|
339
|
+
description: "Use `json` for machine-readable doctor check output or `text` for human-readable output.",
|
|
340
340
|
type: "string"
|
|
341
341
|
}
|
|
342
342
|
};
|
|
@@ -353,7 +353,7 @@ var GLOBAL_OPTION_METADATA = {
|
|
|
353
353
|
type: "string"
|
|
354
354
|
},
|
|
355
355
|
format: {
|
|
356
|
-
description: "Output format for supported commands.",
|
|
356
|
+
description: "Output format for supported commands (`json` or `text`).",
|
|
357
357
|
type: "string"
|
|
358
358
|
},
|
|
359
359
|
id: {
|
|
@@ -580,7 +580,7 @@ function resolveCommandOptionValues(metadata, options) {
|
|
|
580
580
|
|
|
581
581
|
// src/cli-diagnostic-output.ts
|
|
582
582
|
import {
|
|
583
|
-
createCliCommandError,
|
|
583
|
+
createCliCommandError as createCliCommandError2,
|
|
584
584
|
serializeCliDiagnosticError
|
|
585
585
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
586
586
|
|
|
@@ -624,6 +624,72 @@ function findFirstPositionalIndex(argv, metadata) {
|
|
|
624
624
|
const positionalIndexes = collectPositionalIndexes(argv, metadata);
|
|
625
625
|
return positionalIndexes[0] ?? -1;
|
|
626
626
|
}
|
|
627
|
+
function findFirstPositional(argv, metadata) {
|
|
628
|
+
const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
|
|
629
|
+
return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// src/cli-command-resolution.ts
|
|
633
|
+
function resolveEntrypointCliCommand(argv) {
|
|
634
|
+
return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// src/cli-output-format.ts
|
|
638
|
+
import {
|
|
639
|
+
CLI_DIAGNOSTIC_CODES,
|
|
640
|
+
createCliCommandError
|
|
641
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
642
|
+
var PUBLIC_CLI_OUTPUT_FORMATS = ["json", "text"];
|
|
643
|
+
var LEGACY_CLI_OUTPUT_FORMAT_ALIASES = ["toon"];
|
|
644
|
+
var SUPPORTED_CLI_OUTPUT_FORMATS = [
|
|
645
|
+
...PUBLIC_CLI_OUTPUT_FORMATS,
|
|
646
|
+
...LEGACY_CLI_OUTPUT_FORMAT_ALIASES
|
|
647
|
+
];
|
|
648
|
+
var SUPPORTED_CLI_OUTPUT_FORMAT_VALUES = SUPPORTED_CLI_OUTPUT_FORMATS;
|
|
649
|
+
function formatSupportedCliOutputFormats() {
|
|
650
|
+
return PUBLIC_CLI_OUTPUT_FORMATS.join(", ");
|
|
651
|
+
}
|
|
652
|
+
function isSupportedCliOutputFormat(value) {
|
|
653
|
+
return typeof value === "string" && SUPPORTED_CLI_OUTPUT_FORMAT_VALUES.includes(value);
|
|
654
|
+
}
|
|
655
|
+
function formatInvalidCliOutputFormatMessage(value) {
|
|
656
|
+
return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
|
|
657
|
+
}
|
|
658
|
+
function assertSupportedCliOutputFormat(value, argv) {
|
|
659
|
+
if (isSupportedCliOutputFormat(value)) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
throw createCliCommandError({
|
|
663
|
+
code: CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT,
|
|
664
|
+
command: resolveEntrypointCliCommand(argv),
|
|
665
|
+
detailLines: [formatInvalidCliOutputFormatMessage(value)]
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function validateCliOutputFormatArgv(argv) {
|
|
669
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
670
|
+
const arg = argv[index];
|
|
671
|
+
if (!arg) {
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if (arg === "--") {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (arg === "--format") {
|
|
678
|
+
const next = argv[index + 1];
|
|
679
|
+
if (next && !next.startsWith("-")) {
|
|
680
|
+
assertSupportedCliOutputFormat(next, argv);
|
|
681
|
+
index += 1;
|
|
682
|
+
}
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (arg.startsWith("--format=")) {
|
|
686
|
+
const value = arg.slice("--format=".length);
|
|
687
|
+
if (value) {
|
|
688
|
+
assertSupportedCliOutputFormat(value, argv);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
627
693
|
|
|
628
694
|
// src/cli-diagnostic-output.ts
|
|
629
695
|
function prefersStructuredCliArgv(argv) {
|
|
@@ -653,7 +719,7 @@ import {
|
|
|
653
719
|
|
|
654
720
|
// src/add-kind-registry.ts
|
|
655
721
|
import {
|
|
656
|
-
CLI_DIAGNOSTIC_CODES as
|
|
722
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
|
|
657
723
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError2
|
|
658
724
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
659
725
|
|
|
@@ -675,7 +741,7 @@ var ADD_KIND_IDS = [
|
|
|
675
741
|
|
|
676
742
|
// src/cli-string-flags.ts
|
|
677
743
|
import {
|
|
678
|
-
CLI_DIAGNOSTIC_CODES,
|
|
744
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
|
|
679
745
|
createCliDiagnosticCodeError
|
|
680
746
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
681
747
|
function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
@@ -684,12 +750,12 @@ function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
|
684
750
|
return;
|
|
685
751
|
}
|
|
686
752
|
if (typeof value !== "string") {
|
|
687
|
-
throw createCliDiagnosticCodeError(
|
|
753
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
688
754
|
}
|
|
689
755
|
const trimmed = value.trim();
|
|
690
756
|
if (trimmed.length === 0) {
|
|
691
757
|
if (mode === "strict") {
|
|
692
|
-
throw createCliDiagnosticCodeError(
|
|
758
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
693
759
|
}
|
|
694
760
|
return;
|
|
695
761
|
}
|
|
@@ -704,7 +770,7 @@ function readOptionalStrictStringFlag(flags, name) {
|
|
|
704
770
|
function requireStrictStringFlag(flags, name, message) {
|
|
705
771
|
const value = readOptionalStrictStringFlag(flags, name);
|
|
706
772
|
if (!value) {
|
|
707
|
-
throw createCliDiagnosticCodeError(
|
|
773
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
|
|
708
774
|
}
|
|
709
775
|
return value;
|
|
710
776
|
}
|
|
@@ -712,7 +778,7 @@ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message
|
|
|
712
778
|
const leftValue = readOptionalStrictStringFlag(flags, leftName);
|
|
713
779
|
const rightValue = readOptionalStrictStringFlag(flags, rightName);
|
|
714
780
|
if (Boolean(leftValue) !== Boolean(rightValue)) {
|
|
715
|
-
throw createCliDiagnosticCodeError(
|
|
781
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
|
|
716
782
|
}
|
|
717
783
|
return [leftValue, rightValue];
|
|
718
784
|
}
|
|
@@ -793,7 +859,7 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
|
|
|
793
859
|
];
|
|
794
860
|
function requireAddKindName(context, message) {
|
|
795
861
|
if (!context.name) {
|
|
796
|
-
throw createCliDiagnosticCodeError2(
|
|
862
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, message);
|
|
797
863
|
}
|
|
798
864
|
return context.name;
|
|
799
865
|
}
|
|
@@ -812,6 +878,18 @@ function createNamedExecutionPlan(context, options) {
|
|
|
812
878
|
function isAddPersistenceTemplate(template) {
|
|
813
879
|
return template === "persistence" || template === "compound";
|
|
814
880
|
}
|
|
881
|
+
function formatAddBlockTemplateIds(addRuntime) {
|
|
882
|
+
return addRuntime.ADD_BLOCK_TEMPLATE_IDS.join(", ");
|
|
883
|
+
}
|
|
884
|
+
function assertAddBlockTemplateId(context, templateId) {
|
|
885
|
+
if (context.addRuntime.isAddBlockTemplateId(templateId)) {
|
|
886
|
+
return templateId;
|
|
887
|
+
}
|
|
888
|
+
if (templateId === "query-loop") {
|
|
889
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
|
|
890
|
+
}
|
|
891
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
|
|
892
|
+
}
|
|
815
893
|
var ADD_KIND_REGISTRY = {
|
|
816
894
|
"admin-view": defineAddKindRegistryEntry({
|
|
817
895
|
completion: {
|
|
@@ -918,7 +996,8 @@ var ADD_KIND_REGISTRY = {
|
|
|
918
996
|
const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
|
|
919
997
|
const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
|
|
920
998
|
const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
|
|
921
|
-
|
|
999
|
+
const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
|
|
1000
|
+
let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
|
|
922
1001
|
if (!resolvedTemplateId && context.isInteractiveSession) {
|
|
923
1002
|
const templatePrompt = await context.getOrCreatePrompt();
|
|
924
1003
|
resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
|
|
@@ -1334,7 +1413,7 @@ import os from "node:os";
|
|
|
1334
1413
|
import path from "node:path";
|
|
1335
1414
|
import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
|
|
1336
1415
|
import {
|
|
1337
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1416
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
|
|
1338
1417
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError3
|
|
1339
1418
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1340
1419
|
var WP_TYPIA_CONFIG_SOURCES = [
|
|
@@ -1372,7 +1451,7 @@ async function readJsonFile(filePath) {
|
|
|
1372
1451
|
return isRecord(parsed) ? parsed : null;
|
|
1373
1452
|
} catch (error) {
|
|
1374
1453
|
const message = error instanceof Error ? error.message : String(error);
|
|
1375
|
-
throw createCliDiagnosticCodeError3(
|
|
1454
|
+
throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
1376
1455
|
}
|
|
1377
1456
|
}
|
|
1378
1457
|
function resolveConfigPath(cwd, source) {
|
|
@@ -1425,7 +1504,7 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
1425
1504
|
|
|
1426
1505
|
// src/runtime-bridge.ts
|
|
1427
1506
|
import {
|
|
1428
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1507
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
|
|
1429
1508
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError5
|
|
1430
1509
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1431
1510
|
|
|
@@ -1557,9 +1636,10 @@ async function simulateWorkspaceAddDryRun({
|
|
|
1557
1636
|
}
|
|
1558
1637
|
|
|
1559
1638
|
// src/runtime-bridge-output.ts
|
|
1560
|
-
import
|
|
1561
|
-
|
|
1562
|
-
|
|
1639
|
+
import {
|
|
1640
|
+
formatPackageExecCommand,
|
|
1641
|
+
inferPackageManagerId
|
|
1642
|
+
} from "@wp-typia/project-tools/package-managers";
|
|
1563
1643
|
|
|
1564
1644
|
// src/output-markers.ts
|
|
1565
1645
|
var UNICODE_OUTPUT_MARKERS = {
|
|
@@ -1806,32 +1886,6 @@ function buildInitCompletionPayload(plan, markerOptions) {
|
|
|
1806
1886
|
warningLines: plan.notes
|
|
1807
1887
|
};
|
|
1808
1888
|
}
|
|
1809
|
-
function inferProjectPackageManager(projectDir) {
|
|
1810
|
-
try {
|
|
1811
|
-
const packageJsonPath = path3.join(projectDir, "package.json");
|
|
1812
|
-
if (fs3.existsSync(packageJsonPath)) {
|
|
1813
|
-
const manifest = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1814
|
-
if (manifest.packageManager?.startsWith("bun@"))
|
|
1815
|
-
return "bun";
|
|
1816
|
-
if (manifest.packageManager?.startsWith("pnpm@"))
|
|
1817
|
-
return "pnpm";
|
|
1818
|
-
if (manifest.packageManager?.startsWith("yarn@"))
|
|
1819
|
-
return "yarn";
|
|
1820
|
-
if (manifest.packageManager?.startsWith("npm@"))
|
|
1821
|
-
return "npm";
|
|
1822
|
-
}
|
|
1823
|
-
} catch {}
|
|
1824
|
-
if (fs3.existsSync(path3.join(projectDir, "bun.lock")) || fs3.existsSync(path3.join(projectDir, "bun.lockb"))) {
|
|
1825
|
-
return "bun";
|
|
1826
|
-
}
|
|
1827
|
-
if (fs3.existsSync(path3.join(projectDir, "pnpm-lock.yaml"))) {
|
|
1828
|
-
return "pnpm";
|
|
1829
|
-
}
|
|
1830
|
-
if (fs3.existsSync(path3.join(projectDir, "yarn.lock")) || fs3.existsSync(path3.join(projectDir, ".yarnrc.yml"))) {
|
|
1831
|
-
return "yarn";
|
|
1832
|
-
}
|
|
1833
|
-
return "npm";
|
|
1834
|
-
}
|
|
1835
1889
|
function buildMigrationCompletionPayload(options, markerOptions) {
|
|
1836
1890
|
const summaryLines = options.lines.filter((line) => line.trim().length > 0);
|
|
1837
1891
|
return {
|
|
@@ -1841,7 +1895,7 @@ function buildMigrationCompletionPayload(options, markerOptions) {
|
|
|
1841
1895
|
}
|
|
1842
1896
|
function buildAddCompletionPayload(options, markerOptions) {
|
|
1843
1897
|
const verificationLines = [
|
|
1844
|
-
formatPackageExecCommand(options.packageManager ??
|
|
1898
|
+
formatPackageExecCommand(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
|
|
1845
1899
|
];
|
|
1846
1900
|
const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
|
|
1847
1901
|
const completion = buildAddKindCompletionDetails(options.kind, {
|
|
@@ -1902,12 +1956,17 @@ function isInteractiveTerminal({
|
|
|
1902
1956
|
}
|
|
1903
1957
|
// src/runtime-bridge-sync.ts
|
|
1904
1958
|
import { spawnSync } from "node:child_process";
|
|
1905
|
-
import
|
|
1906
|
-
import
|
|
1959
|
+
import fs3 from "node:fs";
|
|
1960
|
+
import path3 from "node:path";
|
|
1907
1961
|
import {
|
|
1908
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1962
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
|
|
1909
1963
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError4
|
|
1910
1964
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1965
|
+
import {
|
|
1966
|
+
formatInstallCommand,
|
|
1967
|
+
formatRunScript,
|
|
1968
|
+
inferPackageManagerId as inferPackageManagerId2
|
|
1969
|
+
} from "@wp-typia/project-tools/package-managers";
|
|
1911
1970
|
var SYNC_INSTALL_MARKERS = [
|
|
1912
1971
|
"node_modules",
|
|
1913
1972
|
".pnp.cjs",
|
|
@@ -1922,66 +1981,17 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
1922
1981
|
if (subcommand === "ai") {
|
|
1923
1982
|
return "ai";
|
|
1924
1983
|
}
|
|
1925
|
-
throw createCliDiagnosticCodeError4(
|
|
1926
|
-
}
|
|
1927
|
-
function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
|
|
1928
|
-
const args = extraArgs.trim();
|
|
1929
|
-
if (packageManagerId === "bun") {
|
|
1930
|
-
return args ? `bun run ${scriptName} ${args}` : `bun run ${scriptName}`;
|
|
1931
|
-
}
|
|
1932
|
-
if (packageManagerId === "npm") {
|
|
1933
|
-
return args ? `npm run ${scriptName} -- ${args}` : `npm run ${scriptName}`;
|
|
1934
|
-
}
|
|
1935
|
-
if (packageManagerId === "pnpm") {
|
|
1936
|
-
return args ? `pnpm run ${scriptName} ${args}` : `pnpm run ${scriptName}`;
|
|
1937
|
-
}
|
|
1938
|
-
return args ? `yarn run ${scriptName} ${args}` : `yarn run ${scriptName}`;
|
|
1939
|
-
}
|
|
1940
|
-
function formatInstallCommand(packageManagerId) {
|
|
1941
|
-
switch (packageManagerId) {
|
|
1942
|
-
case "bun":
|
|
1943
|
-
return "bun install";
|
|
1944
|
-
case "pnpm":
|
|
1945
|
-
return "pnpm install";
|
|
1946
|
-
case "yarn":
|
|
1947
|
-
return "yarn install";
|
|
1948
|
-
default:
|
|
1949
|
-
return "npm install";
|
|
1950
|
-
}
|
|
1984
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
1951
1985
|
}
|
|
1952
1986
|
function getSyncRootError(cwd) {
|
|
1953
|
-
return createCliDiagnosticCodeError4(
|
|
1954
|
-
}
|
|
1955
|
-
function inferSyncPackageManager(cwd, packageManagerField) {
|
|
1956
|
-
const field = String(packageManagerField ?? "");
|
|
1957
|
-
if (field.startsWith("bun@"))
|
|
1958
|
-
return "bun";
|
|
1959
|
-
if (field.startsWith("npm@"))
|
|
1960
|
-
return "npm";
|
|
1961
|
-
if (field.startsWith("pnpm@"))
|
|
1962
|
-
return "pnpm";
|
|
1963
|
-
if (field.startsWith("yarn@"))
|
|
1964
|
-
return "yarn";
|
|
1965
|
-
if (fs4.existsSync(path4.join(cwd, "bun.lock")) || fs4.existsSync(path4.join(cwd, "bun.lockb"))) {
|
|
1966
|
-
return "bun";
|
|
1967
|
-
}
|
|
1968
|
-
if (fs4.existsSync(path4.join(cwd, "pnpm-lock.yaml"))) {
|
|
1969
|
-
return "pnpm";
|
|
1970
|
-
}
|
|
1971
|
-
if (fs4.existsSync(path4.join(cwd, "yarn.lock")) || fs4.existsSync(path4.join(cwd, ".pnp.cjs")) || fs4.existsSync(path4.join(cwd, ".pnp.loader.mjs")) || fs4.existsSync(path4.join(cwd, ".yarnrc.yml"))) {
|
|
1972
|
-
return "yarn";
|
|
1973
|
-
}
|
|
1974
|
-
if (fs4.existsSync(path4.join(cwd, "package-lock.json")) || fs4.existsSync(path4.join(cwd, "npm-shrinkwrap.json"))) {
|
|
1975
|
-
return "npm";
|
|
1976
|
-
}
|
|
1977
|
-
return "npm";
|
|
1987
|
+
return createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.OUTSIDE_PROJECT_ROOT, `No generated wp-typia project root was found at ${cwd}. Run \`wp-typia sync\` from a scaffolded project or official workspace root that already contains generated sync scripts. If you expected this directory to work, cd into the scaffold root first or rerun the scaffold before syncing.`);
|
|
1978
1988
|
}
|
|
1979
1989
|
function resolveSyncProjectContext(cwd) {
|
|
1980
|
-
const packageJsonPath =
|
|
1981
|
-
if (!
|
|
1990
|
+
const packageJsonPath = path3.join(cwd, "package.json");
|
|
1991
|
+
if (!fs3.existsSync(packageJsonPath)) {
|
|
1982
1992
|
throw getSyncRootError(cwd);
|
|
1983
1993
|
}
|
|
1984
|
-
const packageJson = JSON.parse(
|
|
1994
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1985
1995
|
const scripts = packageJson.scripts ?? {};
|
|
1986
1996
|
const syncScripts = {
|
|
1987
1997
|
sync: typeof scripts.sync === "string" ? {
|
|
@@ -2007,17 +2017,17 @@ function resolveSyncProjectContext(cwd) {
|
|
|
2007
2017
|
return {
|
|
2008
2018
|
cwd,
|
|
2009
2019
|
packageJsonPath,
|
|
2010
|
-
packageManager:
|
|
2020
|
+
packageManager: inferPackageManagerId2(cwd, packageJson.packageManager),
|
|
2011
2021
|
scripts: syncScripts
|
|
2012
2022
|
};
|
|
2013
2023
|
}
|
|
2014
2024
|
function findInstalledDependencyMarkerDir(projectDir) {
|
|
2015
|
-
let currentDir =
|
|
2025
|
+
let currentDir = path3.resolve(projectDir);
|
|
2016
2026
|
while (true) {
|
|
2017
|
-
if (SYNC_INSTALL_MARKERS.some((marker) =>
|
|
2027
|
+
if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path3.join(currentDir, marker)))) {
|
|
2018
2028
|
return currentDir;
|
|
2019
2029
|
}
|
|
2020
|
-
const parentDir =
|
|
2030
|
+
const parentDir = path3.dirname(currentDir);
|
|
2021
2031
|
if (parentDir === currentDir) {
|
|
2022
2032
|
return null;
|
|
2023
2033
|
}
|
|
@@ -2040,7 +2050,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
2040
2050
|
if (markerDir) {
|
|
2041
2051
|
return;
|
|
2042
2052
|
}
|
|
2043
|
-
throw createCliDiagnosticCodeError4(
|
|
2053
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.DEPENDENCIES_NOT_INSTALLED, `Project dependencies have not been installed yet. Run \`${formatInstallCommand(project.packageManager)}\` from the project root before \`wp-typia sync\`. The generated sync scripts rely on local tools such as \`tsx\`.`);
|
|
2044
2054
|
}
|
|
2045
2055
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
2046
2056
|
switch (packageManager) {
|
|
@@ -2078,7 +2088,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2078
2088
|
if (target === "ai") {
|
|
2079
2089
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
2080
2090
|
if (!syncAiCommand2) {
|
|
2081
|
-
throw createCliDiagnosticCodeError4(
|
|
2091
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
2082
2092
|
}
|
|
2083
2093
|
return [syncAiCommand2];
|
|
2084
2094
|
}
|
|
@@ -2087,7 +2097,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2087
2097
|
}
|
|
2088
2098
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
2089
2099
|
if (!syncTypesCommand) {
|
|
2090
|
-
throw createCliDiagnosticCodeError4(
|
|
2100
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
2091
2101
|
}
|
|
2092
2102
|
const plannedCommands = [syncTypesCommand];
|
|
2093
2103
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -2161,8 +2171,8 @@ var loadCliScaffoldRuntime = () => import("@wp-typia/project-tools/cli-scaffold"
|
|
|
2161
2171
|
var loadCliTemplatesRuntime = () => import("@wp-typia/project-tools/cli-templates");
|
|
2162
2172
|
var loadMigrationsRuntime = () => import("@wp-typia/project-tools/migrations");
|
|
2163
2173
|
async function wrapCliCommandError(command, error) {
|
|
2164
|
-
const { createCliCommandError:
|
|
2165
|
-
return
|
|
2174
|
+
const { createCliCommandError: createCliCommandError3 } = await loadCliDiagnosticsRuntime();
|
|
2175
|
+
return createCliCommandError3({ command, error });
|
|
2166
2176
|
}
|
|
2167
2177
|
function shouldWrapCliCommandError(options) {
|
|
2168
2178
|
if (options.emitOutput === false) {
|
|
@@ -2367,13 +2377,13 @@ async function executeAddCommand({
|
|
|
2367
2377
|
if (emitOutput) {
|
|
2368
2378
|
printLine(addRuntime.formatAddHelpText());
|
|
2369
2379
|
}
|
|
2370
|
-
throw createCliDiagnosticCodeError5(
|
|
2380
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
|
|
2371
2381
|
}
|
|
2372
2382
|
if (!isAddKindId(kind)) {
|
|
2373
|
-
throw createCliDiagnosticCodeError5(
|
|
2383
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2374
2384
|
}
|
|
2375
2385
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2376
|
-
throw createCliDiagnosticCodeError5(
|
|
2386
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2377
2387
|
}
|
|
2378
2388
|
const executionContext = {
|
|
2379
2389
|
addRuntime,
|
|
@@ -2425,16 +2435,16 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
2425
2435
|
}
|
|
2426
2436
|
if (subcommand === "inspect") {
|
|
2427
2437
|
if (!flags.id) {
|
|
2428
|
-
throw createCliDiagnosticCodeError5(
|
|
2438
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
2429
2439
|
}
|
|
2430
2440
|
const template = getTemplateById(flags.id);
|
|
2431
2441
|
if (!template) {
|
|
2432
|
-
throw createCliDiagnosticCodeError5(
|
|
2442
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
2433
2443
|
}
|
|
2434
2444
|
printBlock([formatTemplateDetails(template)], printLine);
|
|
2435
2445
|
return;
|
|
2436
2446
|
}
|
|
2437
|
-
throw createCliDiagnosticCodeError5(
|
|
2447
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
2438
2448
|
}
|
|
2439
2449
|
async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
|
|
2440
2450
|
try {
|
|
@@ -2522,7 +2532,7 @@ async function executeMigrateCommand({
|
|
|
2522
2532
|
}
|
|
2523
2533
|
|
|
2524
2534
|
// src/command-contract.ts
|
|
2525
|
-
import
|
|
2535
|
+
import path4 from "node:path";
|
|
2526
2536
|
|
|
2527
2537
|
// src/command-registry.ts
|
|
2528
2538
|
var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
|
|
@@ -2736,7 +2746,7 @@ function looksLikeStructuredProjectInput(value) {
|
|
|
2736
2746
|
return value.startsWith("@") && value.includes("/");
|
|
2737
2747
|
}
|
|
2738
2748
|
function assertPositionalAliasProjectDir(projectDir) {
|
|
2739
|
-
const normalizedProjectDir =
|
|
2749
|
+
const normalizedProjectDir = path4.normalize(projectDir).replace(/[\\/]+$/u, "") || path4.normalize(projectDir);
|
|
2740
2750
|
if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
|
|
2741
2751
|
throw new Error(`The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
|
|
2742
2752
|
}
|
|
@@ -2785,9 +2795,9 @@ var NODE_FALLBACK_RUNTIME_SUMMARY_LINES = [
|
|
|
2785
2795
|
`Install Bun 1.3.11+ or use \`bunx wp-typia ...\` for the full Bunli/OpenTUI runtime and Bun-only command surfaces such as \`skills\`, \`completions\`, and \`mcp\`. ${STANDALONE_GUIDANCE_LINE}`,
|
|
2786
2796
|
"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."
|
|
2787
2797
|
];
|
|
2788
|
-
|
|
2798
|
+
var printLine = (line) => {
|
|
2789
2799
|
console.log(line);
|
|
2790
|
-
}
|
|
2800
|
+
};
|
|
2791
2801
|
function printBlock2(lines) {
|
|
2792
2802
|
for (const line of lines) {
|
|
2793
2803
|
printLine(line);
|
|
@@ -2819,7 +2829,7 @@ function parseGlobalFlags(argv) {
|
|
|
2819
2829
|
};
|
|
2820
2830
|
} catch (error) {
|
|
2821
2831
|
if (error instanceof Error && /\`--format\` requires a value\.|\`--id\` requires a value\./.test(error.message)) {
|
|
2822
|
-
throw createCliDiagnosticCodeError6(
|
|
2832
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, error.message);
|
|
2823
2833
|
}
|
|
2824
2834
|
throw error;
|
|
2825
2835
|
}
|
|
@@ -2874,91 +2884,58 @@ function renderGeneralHelp() {
|
|
|
2874
2884
|
`- ${WP_TYPIA_POSITIONAL_ALIAS_USAGE}`
|
|
2875
2885
|
]);
|
|
2876
2886
|
}
|
|
2877
|
-
function
|
|
2878
|
-
printBlock2([
|
|
2879
|
-
"wp-typia templates <list|inspect>",
|
|
2880
|
-
"",
|
|
2881
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2882
|
-
"",
|
|
2883
|
-
"Supported flags:",
|
|
2884
|
-
...formatNodeFallbackOptionHelp(TEMPLATES_OPTION_METADATA)
|
|
2885
|
-
]);
|
|
2886
|
-
}
|
|
2887
|
-
function renderCreateHelp() {
|
|
2888
|
-
printBlock2([
|
|
2889
|
-
`Usage: ${WP_TYPIA_CANONICAL_CREATE_USAGE}`,
|
|
2890
|
-
"",
|
|
2891
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2892
|
-
"",
|
|
2893
|
-
"Supported flags:",
|
|
2894
|
-
...formatNodeFallbackOptionHelp(CREATE_OPTION_METADATA)
|
|
2895
|
-
]);
|
|
2896
|
-
}
|
|
2897
|
-
function renderInitHelp() {
|
|
2898
|
-
printBlock2([
|
|
2899
|
-
"Usage: wp-typia init [project-dir]",
|
|
2900
|
-
"",
|
|
2901
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2902
|
-
"",
|
|
2903
|
-
"Preview-by-default retrofit planner for existing WordPress block or plugin projects. Re-run with --apply to write package.json updates and helper scripts.",
|
|
2904
|
-
"",
|
|
2905
|
-
"Supported flags:",
|
|
2906
|
-
...formatNodeFallbackOptionHelp(INIT_OPTION_METADATA)
|
|
2907
|
-
]);
|
|
2908
|
-
}
|
|
2909
|
-
function renderAddHelp() {
|
|
2910
|
-
printBlock2([
|
|
2911
|
-
"Usage: wp-typia add <kind> <name>",
|
|
2912
|
-
"",
|
|
2913
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2914
|
-
"",
|
|
2915
|
-
`Supported kinds: ${formatAddKindList()}`,
|
|
2916
|
-
"",
|
|
2917
|
-
"Supported flags:",
|
|
2918
|
-
...formatNodeFallbackOptionHelp(ADD_OPTION_METADATA)
|
|
2919
|
-
]);
|
|
2920
|
-
}
|
|
2921
|
-
function renderMigrateHelp() {
|
|
2922
|
-
printBlock2([
|
|
2923
|
-
`Usage: ${WP_TYPIA_CANONICAL_MIGRATE_USAGE}`,
|
|
2924
|
-
"",
|
|
2925
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2926
|
-
"",
|
|
2927
|
-
"Supported flags:",
|
|
2928
|
-
...formatNodeFallbackOptionHelp(MIGRATE_OPTION_METADATA)
|
|
2929
|
-
]);
|
|
2930
|
-
}
|
|
2931
|
-
function renderSyncHelp() {
|
|
2932
|
-
printBlock2([
|
|
2933
|
-
"Usage: wp-typia sync [ai]",
|
|
2934
|
-
"",
|
|
2935
|
-
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2936
|
-
"",
|
|
2937
|
-
"Supported flags:",
|
|
2938
|
-
...formatNodeFallbackOptionHelp(SYNC_OPTION_METADATA)
|
|
2939
|
-
]);
|
|
2940
|
-
}
|
|
2941
|
-
function renderDoctorHelp() {
|
|
2887
|
+
function renderNodeFallbackCommandHelp(config) {
|
|
2942
2888
|
printBlock2([
|
|
2943
|
-
|
|
2889
|
+
config.heading,
|
|
2944
2890
|
"",
|
|
2945
2891
|
...NODE_FALLBACK_RUNTIME_SUMMARY_LINES,
|
|
2946
2892
|
"",
|
|
2947
|
-
|
|
2948
|
-
"",
|
|
2893
|
+
...config.bodyLines ? [...config.bodyLines, ""] : [],
|
|
2949
2894
|
"Supported flags:",
|
|
2950
|
-
...formatNodeFallbackOptionHelp(
|
|
2895
|
+
...formatNodeFallbackOptionHelp(config.optionMetadata)
|
|
2951
2896
|
]);
|
|
2952
2897
|
}
|
|
2953
|
-
var
|
|
2954
|
-
add:
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2898
|
+
var NODE_FALLBACK_COMMAND_HELP_CONFIG = {
|
|
2899
|
+
add: {
|
|
2900
|
+
bodyLines: [`Supported kinds: ${formatAddKindList()}`],
|
|
2901
|
+
heading: "Usage: wp-typia add <kind> <name>",
|
|
2902
|
+
optionMetadata: ADD_OPTION_METADATA
|
|
2903
|
+
},
|
|
2904
|
+
create: {
|
|
2905
|
+
heading: `Usage: ${WP_TYPIA_CANONICAL_CREATE_USAGE}`,
|
|
2906
|
+
optionMetadata: CREATE_OPTION_METADATA
|
|
2907
|
+
},
|
|
2908
|
+
doctor: {
|
|
2909
|
+
bodyLines: [
|
|
2910
|
+
"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."
|
|
2911
|
+
],
|
|
2912
|
+
heading: "Usage: wp-typia doctor [--format json]",
|
|
2913
|
+
optionMetadata: DOCTOR_OPTION_METADATA
|
|
2914
|
+
},
|
|
2915
|
+
init: {
|
|
2916
|
+
bodyLines: [
|
|
2917
|
+
"Preview-by-default retrofit planner for existing WordPress block or plugin projects. Re-run with --apply to write package.json updates and helper scripts."
|
|
2918
|
+
],
|
|
2919
|
+
heading: "Usage: wp-typia init [project-dir]",
|
|
2920
|
+
optionMetadata: INIT_OPTION_METADATA
|
|
2921
|
+
},
|
|
2922
|
+
migrate: {
|
|
2923
|
+
heading: `Usage: ${WP_TYPIA_CANONICAL_MIGRATE_USAGE}`,
|
|
2924
|
+
optionMetadata: MIGRATE_OPTION_METADATA
|
|
2925
|
+
},
|
|
2926
|
+
sync: {
|
|
2927
|
+
heading: "Usage: wp-typia sync [ai]",
|
|
2928
|
+
optionMetadata: SYNC_OPTION_METADATA
|
|
2929
|
+
},
|
|
2930
|
+
templates: {
|
|
2931
|
+
heading: "wp-typia templates <list|inspect>",
|
|
2932
|
+
optionMetadata: TEMPLATES_OPTION_METADATA
|
|
2933
|
+
}
|
|
2961
2934
|
};
|
|
2935
|
+
var NODE_FALLBACK_HELP_RENDERERS = Object.fromEntries(Object.entries(NODE_FALLBACK_COMMAND_HELP_CONFIG).map(([command, config]) => [
|
|
2936
|
+
command,
|
|
2937
|
+
() => renderNodeFallbackCommandHelp(config)
|
|
2938
|
+
]));
|
|
2962
2939
|
function renderVersion(options = {}) {
|
|
2963
2940
|
if (options.format === "json") {
|
|
2964
2941
|
printLine(JSON.stringify({
|
|
@@ -2982,16 +2959,16 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
2982
2959
|
}
|
|
2983
2960
|
const templateId = flags.id;
|
|
2984
2961
|
if (!templateId) {
|
|
2985
|
-
throw
|
|
2986
|
-
code:
|
|
2962
|
+
throw createCliCommandError3({
|
|
2963
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
2987
2964
|
command: "templates",
|
|
2988
2965
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
2989
2966
|
});
|
|
2990
2967
|
}
|
|
2991
2968
|
const template = getTemplateById(templateId);
|
|
2992
2969
|
if (!template) {
|
|
2993
|
-
throw
|
|
2994
|
-
code:
|
|
2970
|
+
throw createCliCommandError3({
|
|
2971
|
+
code: CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT,
|
|
2995
2972
|
command: "templates",
|
|
2996
2973
|
detailLines: [`Unknown template "${templateId}".`]
|
|
2997
2974
|
});
|
|
@@ -3001,8 +2978,8 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
3001
2978
|
}, null, 2));
|
|
3002
2979
|
}
|
|
3003
2980
|
function renderUnsupportedCommand(command) {
|
|
3004
|
-
throw
|
|
3005
|
-
code:
|
|
2981
|
+
throw createCliCommandError3({
|
|
2982
|
+
code: CLI_DIAGNOSTIC_CODES7.UNSUPPORTED_COMMAND,
|
|
3006
2983
|
command,
|
|
3007
2984
|
detailLines: [
|
|
3008
2985
|
[
|
|
@@ -3017,7 +2994,7 @@ function renderUnsupportedCommand(command) {
|
|
|
3017
2994
|
async function renderDoctorJson() {
|
|
3018
2995
|
const [
|
|
3019
2996
|
{ getDoctorChecks },
|
|
3020
|
-
{ createCliCommandError:
|
|
2997
|
+
{ createCliCommandError: createCliCommandError4, getDoctorFailureDetailLines }
|
|
3021
2998
|
] = await Promise.all([
|
|
3022
2999
|
import("@wp-typia/project-tools/cli-doctor"),
|
|
3023
3000
|
import("@wp-typia/project-tools/cli-diagnostics")
|
|
@@ -3027,8 +3004,8 @@ async function renderDoctorJson() {
|
|
|
3027
3004
|
checks
|
|
3028
3005
|
}, null, 2));
|
|
3029
3006
|
if (checks.some((check) => check.status === "fail")) {
|
|
3030
|
-
throw
|
|
3031
|
-
code:
|
|
3007
|
+
throw createCliCommandError4({
|
|
3008
|
+
code: CLI_DIAGNOSTIC_CODES7.DOCTOR_CHECK_FAILED,
|
|
3032
3009
|
command: "doctor",
|
|
3033
3010
|
detailLines: getDoctorFailureDetailLines(checks),
|
|
3034
3011
|
summary: "One or more doctor checks failed."
|
|
@@ -3044,8 +3021,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3044
3021
|
if (!positionals[1]) {
|
|
3045
3022
|
const { formatAddHelpText } = await import("@wp-typia/project-tools/cli-add");
|
|
3046
3023
|
printLine(formatAddHelpText());
|
|
3047
|
-
throw
|
|
3048
|
-
code:
|
|
3024
|
+
throw createCliCommandError3({
|
|
3025
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
3049
3026
|
command: "add",
|
|
3050
3027
|
detailLines: [
|
|
3051
3028
|
`\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`
|
|
@@ -3064,7 +3041,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3064
3041
|
name: positionals[2]
|
|
3065
3042
|
});
|
|
3066
3043
|
} catch (error) {
|
|
3067
|
-
throw
|
|
3044
|
+
throw createCliCommandError3({
|
|
3068
3045
|
command: "add",
|
|
3069
3046
|
error
|
|
3070
3047
|
});
|
|
@@ -3092,8 +3069,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3092
3069
|
}) => {
|
|
3093
3070
|
const projectDir = positionals[1];
|
|
3094
3071
|
if (!projectDir) {
|
|
3095
|
-
throw
|
|
3096
|
-
code:
|
|
3072
|
+
throw createCliCommandError3({
|
|
3073
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
3097
3074
|
command: "create",
|
|
3098
3075
|
detailLines: [
|
|
3099
3076
|
"`wp-typia create` requires <project-dir>.",
|
|
@@ -3111,7 +3088,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3111
3088
|
projectDir
|
|
3112
3089
|
});
|
|
3113
3090
|
} catch (error) {
|
|
3114
|
-
throw
|
|
3091
|
+
throw createCliCommandError3({
|
|
3115
3092
|
command: "create",
|
|
3116
3093
|
error
|
|
3117
3094
|
});
|
|
@@ -3189,7 +3166,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3189
3166
|
}));
|
|
3190
3167
|
}
|
|
3191
3168
|
} catch (error) {
|
|
3192
|
-
throw
|
|
3169
|
+
throw createCliCommandError3({
|
|
3193
3170
|
command: "sync",
|
|
3194
3171
|
error
|
|
3195
3172
|
});
|
|
@@ -3203,8 +3180,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3203
3180
|
const templateId = typeof mergedFlags.id === "string" ? mergedFlags.id : positionals[2];
|
|
3204
3181
|
const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
|
|
3205
3182
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3206
|
-
throw
|
|
3207
|
-
code:
|
|
3183
|
+
throw createCliCommandError3({
|
|
3184
|
+
code: CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND,
|
|
3208
3185
|
command: "templates",
|
|
3209
3186
|
detailLines: [
|
|
3210
3187
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -3229,6 +3206,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3229
3206
|
async function runNodeCli(argv = process.argv.slice(2)) {
|
|
3230
3207
|
const normalizedArgv = normalizeWpTypiaArgv(argv);
|
|
3231
3208
|
const { argv: argvWithoutConfigOverride, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
|
|
3209
|
+
validateCliOutputFormatArgv(argvWithoutConfigOverride);
|
|
3232
3210
|
const { argv: cliArgv, flags } = parseGlobalFlags(argvWithoutConfigOverride);
|
|
3233
3211
|
const { flags: commandFlags, positionals } = parseArgv(cliArgv);
|
|
3234
3212
|
const rawMergedFlags = {
|
|
@@ -3305,4 +3283,4 @@ export {
|
|
|
3305
3283
|
hasFlagBeforeTerminator
|
|
3306
3284
|
};
|
|
3307
3285
|
|
|
3308
|
-
//# debugId=
|
|
3286
|
+
//# debugId=A8E2D093C9BAE2C064756E2164756E21
|